PowerShell is a command-line utility to automate various tasks or to build tools using its scripting language support. PowerShell has built-in support available for the Windows Operating system. However, it can be installed on various Linux distributions due to its open-source cross-platform support.

Ubuntu is the widely used Debian based Linux distribution. Ubuntu has recently released its Long-Term Support 22.04 with a code name “Jammy Jellyfish”.

This article lists down possible methods to install PowerShell on Ubuntu 22.04 with the following learning outcomes:

How to install PowerShell on Ubuntu 22.04

Ubuntu 22.04 has its own command line terminal with advanced support for Network/System administrators. However, PowerShell can be used as a secondary terminal on Ubuntu 22.04. The following possible methods can be used to install PowerShell on Ubuntu 22.04.

How to install PowerShell on Ubuntu 22.04 from snap

The snap package manager provides a command line and a GUI store to get applications/programs on Ubuntu 22.04.

Step 1: Firstly, install the snap package manager’s service on your system as follows:

$ sudo apt install snap snapd

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/word-image-182775-1.png" data-lazy- height="246" src="data:image/svg xml,” width=”712″>

We already have the latest version of the snapd.

Step 2: Now, makes use of the below-mentioned command to install PowerShell on Ubuntu:

$ sudo snap install powershell –classic

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/word-image-182775-2.png" data-lazy- height="82" src="data:image/svg xml,” width=”691″>

Once it is installed, you can launch the PowerShell terminal by using the following keywords in Ubuntu’s terminal:

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/word-image-182775-3.png" data-lazy- height="161" src="data:image/svg xml,” width=”623″>

It is observed that the PowerShell’s session is started.

How to install PowerShell from the Ubuntu 22.04 repository

Ubuntu has not yet provided support for PowerShell in its official repository. However, the PowerShell repository can be installed on Ubuntu 22.04.

Step 1: First, download the “.deb” package of PowerShell’s repository for Ubuntu via the following command:

$ wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/word-image-182775-4.png" data-lazy- height="61" src="data:image/svg xml,” width=”731″>

After downloading the “.deb” file, install it by issuing the below-mentioned command:

$ sudo dpkg -i packages-microsoft-prod.deb

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/word-image-182775-5.png" data-lazy- height="130" src="data:image/svg xml,” width=”725″>

Step 2: Update the core libraries of Ubuntu 22.04 as follows:

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/word-image-182775-6.png" data-lazy- height="238" src="data:image/svg xml,” width=”729″>

Once the update is performed and the PowerShell repository is acknowledged by your system. Install PowerShell as follows:

$ sudo apt install powershell

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/word-image-182775-7.png" data-lazy- height="348" src="data:image/svg xml,” width=”727″>

The output states that the installation has been completed successfully which states the PowerShell is now installed on Ubuntu 22.04.

How to remove PowerShell from Ubuntu 22.04

PowerShell can be used as a secondary terminal on your Ubuntu 22.04. It can be removed from Ubuntu 22.04 by using one of the following commands.

If PowerShell is installed using the snap package manager, then you can remove/uninstall it by issuing the following command:

$ sudo snap remove powershell

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/word-image-182775-8.png" data-lazy- height="67" src="data:image/svg xml,” width=”614″>

If PowerShell is installed by adding its repository, then it can be removed/uninstalled from Ubuntu 22.04 as follows:

$ sudo apt autoremove –purge powershell

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/06/echo/word-image-182775-9.png" data-lazy- height="332" src="data:image/svg xml,” width=”727″>

Conclusion

PowerShell can be installed on Ubuntu 22.04 from the snap package manager or from the PowerShell’s repository. You have learned both methods to get PowerShell on Ubuntu 22.04. PowerShell is a multipurpose tool for automating several tasks on a computing machine or to develop any tools using its scripting language support. Although PowerShell is an open-source, Ubuntu has not yet added it to its official repository. However, we have provided multiple alternative ways to get PowerShell on Ubuntu 22.04.