Installation (PowerShell Core)
Allows you to run PowerShell Core from a Linux or macOS host or even AWS Lambda .NET Core 2.1 runtime (as well on a Windows machine). Note that it is a significantly cut down environment from what you'd expect when running within a Windows OS. Part of the power of Windows PowerShell is that it makes anything that's exposed through the full .NET Framework is available to PowerShell, but much of this is specific to Windows. PowerShell Core is dependant on .NET Core, which is stripped down so that it can run on more platforms. This does cause some gotchas, for example cryptography is not available in .NET Core, therefore you can't create secure strings (which you'd normally use for handling passwords).
These instructions are for Ubuntu 16.04 LTS, but can be adapted for other versions as indicated, for other distributions see https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6 for further info. The procedure below has been tested on both Ubuntu 14.04 and 16.04. However, be aware that if need to use a locale/culture other than en_US, you may find that the below won't install PowerShell with correct culture - see Ubuntu 18 / Correct Culture below.
- Register Microsoft repository GPG key
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
- Add the Microsoft repository to aptitude sources (change the MS URL to fix your OS version)
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list
- Update list of available packages
- Install PowerShell Core
apt install powershell
- Launch PowerShell
Ubuntu 18 / Correct Culture
You need to have the OS locale correct before you install PowerShell, as long as this is correct you should end up with the right version. The procedure below assumes en_GB, use the correct code for you.
Check / correct locale
- Check Ubuntu is using the correct culture
- If your locale is not displayed, if not check what is currently available
- If your locale is not displayed, generate it
- To set Ubuntu to use the correct locale use the following command
- Reboot for the change to take effect
- Install snap
snap install powershell --classic
- Go into PowerShell CLI and check culture
Can be installed side by side with Windows PowerShell.
- Download latest win-x64.msi package from https://github.com/PowerShell/PowerShell/releases
- Install downloaded package