Executing Powershell in Ubuntu Linux machine

PowerShell can be also now execute in machines running on Ubuntu OS. Before installing you may need to follow set a prerequisites to get the list of packages and then get the Powershell package directly from Microsoft and directly install it on a Ubuntu machine.This can be done by following the below steps

Step 1: Get the list of Packages using “sudo apt-get update”

Step 2: Install the Prerequisite Packages “sudo apt-get install -y wget apt-transport-https software-properties-common”

Step 3: Execute wget -q “https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb”

The above commands updates the packages and downloads the Powershell package from Microsoft packages site. Once the above steps are done.All you need to do is execute another set of commands to install the Package as shown below

Step 4: Execute to install Microsoft repository GPG keys dpkg -i packages-microsoft-prod.deb

Step 5: Execute to delete Package Keys “rm packages-microsoft-prod.deb”

Step 6: Update the Packages “sudo apt-get update”

Step 7: Install the Powershell “sudo apt-get install -y powershell”

Once the installation is done, check whether executing pwsh command opens the powershell window, if it opens the powershell command prompt, then powershell is already installed in your system which can be used to execute the powershell commands.

You may also like...