As you may notice, only the deb package for PowerShell 6-Preview.3 is available for installation. So, only when it becomes GA (Generally Available), then we’ll see the repository documentation included for Ubuntu 18.04 and CentOS 7 installation.
But, don’t worry! Below are some undocumented steps for installing PowerShell Core Preview.3 release.
Installing PowerShell Core 6-Preview.3
1. Download PowerShell Core dpkg *deb for Linux Ubuntu 18.04 or the *rpm package for CentOS 7 from the Release page, and look:
2. Then, execute the next two lines because the first one will not complete successfully:
-For Ubuntu 18.04 dpkg *deb package-
sudo dpkg -i powershell-preview_6.1.0-preview.3-1.ubuntu.18.04_amd64.deb
sudo apt-get install -f
sudo yum install powershell-preview-6.1.0-preview.3-1.rhel.7.x86_64.rpm
In either Ubuntu and CentoOS, the installation will seems that will complete without any failures. But, when typing pwsh will not work.
Use the following workarounds if you feel is convenient to use. Please skip to the “Things Are Changing!” and check out “Undocumented Tips” section.
Execute PowerShell Core – Workaround #1
Type the full path, and PowerShell Core will start:
But, of course we don’t want to do this every time.
Execute PowerShell Core – Workaround #2
So, let Just add the PowerShell Core path to the user ~/.bashrc file, follow with reloading Bashrc:
echo ‘export PATH=”$PATH:/opt/microsoft/powershell/6-preview”‘ >> ~/.bashrc
After all this done, now we can start PowerShell Core from the Ubuntu 18.04 terminal.
Things Are Changing! (Added – 06/14/2018)
Please make sure to read the PowerShell Core v6.1.0-preview.3 Release Notes. It announce changes to the PowerShell Core executable for both Linux Distro and MacOS. So, although the above workaround mention works, you can just open PowerShell Core Console by typing “pwsh-preview”.
Undocumented Tips (Added 06/16/2018)
Repo installation is available!
Most important to be aware of these few tips. You won’t find PowerShell 6.1.0-Preview.3 in any repository. But, there is a PowerShell-Preview.
Now, uninstalling PowerShell Core if you got the PowerShell 6.1.0-Preview.2 installed, then it need to:
sudo apt remove powershell
- CentOS 7
sudo yum remove powershell
But, in the case you need to remove or reinstall PowerShell Core Preview.3 in either Ubuntu and CentOS then use:
sudo apt remove powershell-preview
- CentOS 7
sudo yum remove powershell-preview
Now, to install PowerShell Core Preview.3, beside been able to use either the dpkg *deb package for Ubuntu or the *rpm package to install it, you can use the following command:
sudo apt install powershell-preview
- CentOS 7
sudo yum install powershell-preview
These instruction was not documented at the time of the release of PowerShell Core Preview.3.
Thanks for the PowerShell Core Github Community for all the information available about PowerShell Core installation. I know this documentation will be eventually updated in due time.
Be Bold! Learn PowerShell Core!