How to Install PowerShell in Ubuntu 20.04 lts
All packages are available on our GitHub releases page. After the package is installed, run pwsh from a terminal. Run pwsh-preview if you installed a Preview release.
For Linux distributions that aren’t officially supported, you can try to install PowerShell using the PowerShell Snap Package. You can also try deploying PowerShell binaries directly using the Linux tar.gz archive, but you would need to set up the necessary dependencies based on the OS in separate steps.
Officially supported platform releases for PowerShell 7.1
- Ubuntu 16.04/18.04/20.04 (including ARM64)
- Ubuntu 19.10 (via Snap package)
- Debian 9/10
- CentOS and RHEL 7/8
- Fedora 30
- Alpine 3.11+ (including ARM64)
Officially supported platform releases for PowerShell 7.0
- Ubuntu 16.04
- Ubuntu 18.04 and 20.04
- Debian 8
- Debian 9
- Debian 10
- Alpine 3.9 and 3.10
- CentOS 7
- Red Hat Enterprise Linux (RHEL) 7
- Fedora 28
- Fedora 29
- Fedora 30
- openSUSE 42.3
- openSUSE Leap 15
Community supported releases
- Ubuntu 18.10
- Ubuntu 19.10 and 20.10
- Arch Linux
- Kali
- Raspbian (experimental)
Alternate install methods
- Snap Package
- Binary Archives
- .NET Global tool
Installation via Package Repository – Ubuntu 20.04
PowerShell for Linux is published to package repositories for easy installation and updates.
The preferred method is as follows:
# Update the list of packages
sudo apt-get update
# Install pre-requisite packages.
sudo apt-get install -y wget apt-transport-https software-properties-common
# Download the Microsoft repository GPG keys
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
# 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
pwsh
As superuser, register the Microsoft repository once. After registration, you can update PowerShell with sudo apt-get install powershell
.
Installation via Direct Download – Ubuntu 20.04
Download the Debian package powershell_7.1.4-1.ubuntu.20.04_amd64.deb from the releases page onto the Ubuntu machine.
Then, in the terminal, execute the following commands:
sudo dpkg -i powershell_7.1.4-1.ubuntu.20.04_amd64.deb
sudo apt-get install -f
Uninstallation – Ubuntu 20.04
sudo apt-get remove powershell
Reference Link: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7.1