Installing Powershell in Ubuntu 19.04

Before you ask.. why?! The reasoning behind this was simply scientific interest (And the “/usr/bin/pwch could not be found” error in Visual Studio Code was getting annoying while writing some Powershell scripts from my Desktop!)

Installing Pre-requisits:

The article below from the Microsoft does not cover installing the pre-requisits for installing Powershell on Ubuntu – I have written this guide to save you scowering the internet for the packages.

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu6_amd64.deb
sudo dpkg -i libssl1.0.0_1.0.2n-1ubuntu6_amd64.deb
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt-get update
sudo apt-get install libicu55

You can now proceed with the instructions from the Microsoft article (Below for your convenience):

Powershell Install:

wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y powershell

You can now run Powershell with the pwsh command:

[email protected]:~$ pwsh 
PowerShell 6.2.3
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS /home/tim>

Microsoft Documentation:

https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-6

Any comments or questions? Get in touch here or Email me at [email protected]