In this article, I will explain How to install Powershell on Ubuntu 20.04. Ideally PowerShell package doesn’t come as default in Ubuntu Operating System.
As PowerShell is a powerful scripting language for system administration or DevOps Engineer. You can write very simple or complex scripts using PowerShell to automate your daily manual tasks.
Below are simple step to install Powershell on Ubuntu system.
A- Installation Using Package Repository-Ubuntu 20.04
The eays method is as follows:
Step-1 First Update the list of packages
sudo apt-get update

Step-2 Install pre-requisite packages on local machine
sudo apt-get install -y wget apt-transport-https software-properties-common

Step-3 Download the Microsoft repository GPG keys
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb

Step-4 Now Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb

Step-5 Update the list of packages after we added packages.microsoft.com
sudo apt-get update

Step-6 Enable the “universe” repositories.
sudo add-apt-repository universe

Step-7 Now you can install PowerShell
sudo apt-get install -y powershell

Step-8 Now start PowerShell
pwsh

B- Installation Using Direct Download – Ubuntu 20.04
If you have downloaded the Package on your system. Use the below commands in the terminal to install PowerShell.
sudo dpkg -i powershell_7.1.4-1.ubuntu.20.04_amd64.deb
sudo apt-get install -f
Now you know how to run PowerShell commands and script. You should be able to start doing simple task first. That’s all floks!! Hope you learned some useful tips.