Install PowerShell on Ubuntu 20.04

December 08, 2020

tags: powershell linux ubuntu vscode snippet 

Profile picture

Written by Chris Odegard

I wanted to install PowerShell on my remote* development server, which runs Ubuntu, so I can do all my dev work in the same environment. Since PowerShell is supported on all platforms now, that should be fairly simple.

The following snippet is clipped from the below page:

Installation via Package Repository - Ubuntu 20.04

# Update the list of packages
sudo apt-get update
# Install pre-requisite packages.
sudo apt-get install -y wget apt-transport-https
# Download the Microsoft repository GPG keys
wget -q
# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb
# Update the list of products
sudo apt-get update
# Enable the "universe" repositories
sudo add-apt-repository universe
# Install PowerShell
sudo apt-get install -y powershell
# Start PowerShell

As superuser, register the Microsoft repository once. After registration, you can update PowerShell with sudo apt-get install powershell.

* I say “remote” but it’s actually just down the hall from my bedroom.