We know that PowerShell is open source. It is now available for both Linux and Mac. You can download the official packages from Microsoft for all the 64-bit versions of Ubuntu 16.10, Ubuntu 16.04, Red Hat Enterprise Linux 7, CentOS 7, and Mac OS X 10.11.
Download these Packages from the Microsoft
Now head out to GitHub and visit the PowerShell’s project Releases page. This is where you can find the necessary packages. Download the one for your operating system:
- Ubuntu 16.10: Download this package ending in “16.10.1_amd64.deb”.
- Ubuntu 16.04: Download this package ending in “16.04.1_amd64.deb”.
- Red Hat Enterprise Linux 7 and CentOS 7: Download this package ending in “el7.centos.x86_64.rpm”.
How to Install the PowerShell on Linux
Now that you have downloaded the package, launch a terminal window on your Linux PC. You will now need to install package’s dependencies and also the package itself.
On Ubuntu 16.04 and Ubuntu 16.10, run the following commands:
sudo apt-get install libunwind8 libicu55 sudo dpkg -i /path/to/powershell.deb
So, if you have downloaded the package “powershell_6.0.0-alpha.9-1ubuntu1.16.04.1_amd64.deb” in the Downloads folder of your home folder, you would have to run the following commands:
sudo apt-get install libunwind8 libicu55 sudo dpkg -i ~/Downloads/powershell_6.0.0-alpha.9-1ubuntu1.16.04.1_amd64.deb
Now you can use the tab completion to speed up this process. Just for example, if the file was lets say in your Downloads folder, you would type ~/Downloads/powershell and then you will press Tab. Bash will have automatically completed the file name if it is the only file which starts with “powershell” in that specified directory.
If you are using Ubuntu 14.04(you should probably upgrade), run these following commands in terminal:
sudo apt-get install libunwind8 libicu52 sudo dpkg -i /path/to/powershell.deb
For CentOS 7 users, run the following commands in terminal:
sudo yum install /path/to/powershell.rpm
If everything goes as it should, PowerShell should be installed on your PC.
How to Launch the PowerShell on Linux
Open up a terminal and just run the “powershell” command to access the PowerShell shell environment.
You’ll see a PowerShell prompt beginning with “PS”, and you can run PowerShell cmdlets just as you would on Windows.