Now PowerShell is open source. It can be installed on Linux and Mac. The Microsoft PowerShell packages for the 64-bit versions of Ubuntu 16.04, Ubuntu 14.04, CentOS 7, RedHat Enterprise Linux 7 and Mac OS X 10.11 can be downloaded from PowerShell’s GitHub page. Now let’s see how to install PowerShell on Linux.
How to Install Microsoft PowerShell on Linux
1. First download the PowerShell Packages from PowerShell’s GitHub page. Below are the options for Linux:
Ubuntu 16.04: Download the package ending in “16.04.1_amd64.deb”.
Ubuntu 14.04: Download the package ending in “14.04.1_amd64.deb”.
CentOS 7 and Red Hat Enterprise Linux 7: Download the package ending in “el7.centos.x86_64.rpm”.
2. Now on your Linux system, open a terminal window.
3. Now for Ubuntu 16.04, run the commands given below in the Terminal:
(The command is assuming that you have downloaded the package in the Downloads folder in the home folder)
sudo apt-get install libunwind8 libicu55
sudo dpkg -i ~/Downloads/powershell_6.0.0-alpha.9-1ubuntu1.16.04.1_amd64.deb
For Ubuntu 14.04,run the commands given below in the Terminal:
sudo apt-get install libunwind8 libicu52
sudo dpkg -i /path/to/powershell.deb
For CentOS 7, run the commands given below in the Terminal:
sudo yum install /path/to/powershell.rpm
4. Now to launch PowerShell on Linux, launch a terminal.
5. Then run the powershell command.
6. This is open the PowerShell shell environment with a prompt beginning with PS.
7. When you wish to leave the PowerShell prompt, type exit
.
8. Then press Enter or close the terminal.