How to install PowerShell 7 on Linux

Microsoft PowerShell is cross-platform scripting tool, and these are the steps to install it on Linux.

PowerShell 7 on Linux
PowerShell 7 on Linux

If you use PowerShell on Windows 10, but you also require to use a Linux distribution (such as Ubuntu) for work, you can now install the Microsoft command-line shell and scripting language in the most popular flavors of the open source operating system.

At the time of this writing, you can install PowerShell 7, which is built on .NET Core 3.1, but it’s backward compatible with the modules for older releases.

In this guide, you’ll learn the steps to install PowerShell 7 on Ubuntu using graphical user interface (GUI) or command line. (These are the steps to install the tool on Windows 10.)

How to install PowerShell using Ubuntu Software

  1. Open Ubuntu Software app.

  2. Search for PowerShell.

  3. Select the powershell option.

  4. Click the Install button.

    Install PowerShell Ubuntu Software app
    Install PowerShell Ubuntu Software app

Once you complete the steps, you can access the app using the pwsh on the Linux Terminal.

If you want to uninstall it, then on the “Ubuntu Software” app, click the Installed tab, and click the Remove button for PowerShell.

How to install PowerShell using package installer

To install PowerShell on Linux using GUI installer, use these steps:

  1. Open PowerShell download page on GitHub.

  2. Under the “Assets” section, click the powershell_7.x.x-x.ubuntu.xx.xx_amd64.deb depending on the version of Ubuntu on your device.

    PowerShell 7 deb package download
    PowerShell 7 deb package download
    Quick note: PowerShell is also available for other flavors of Linux, including CentOS, Alpine, Red Hat, and Debian.
  3. Save the file on your device.

  4. Double-click the *.deb file to launch the installer.

    PowerShell Ubuntu amd64 deb package
    PowerShell Ubuntu amd64 deb package
  5. Click the Install button.

    PowerShell GUI installer
    PowerShell GUI installer

Once you complete the steps, PowerShell will install, and you can launch it from the Terminal using the pwsh command.

If you run into dependencies problems, then use the steps below to install PowerShell using command lines.

How to install PowerShell using Snap command on Ubuntu

To update the PowerShell app on Linux, use these steps:

  1. Open Terminal.

  2. Type the following command to install PowerShell and press Enter:

    sudo snap install powershell --classic

    Snap install PowerShell command
    Snap install PowerShell command

After you complete the steps, you can start the Microsoft scripting tool using the pwsh command in the Terminal.

If you want to uninstall the tool, from the Terminal, type the sudo snap remove powershell command.

How to install PowerShell using using Package Repository on Ubuntu

To install PowerShell on Linux using Package Repository, use these steps:

  1. Open Terminal.

  2. Type the following command to download the Microsoft repository GPG keys and press Enter:

    wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
  3. Type the following command to register the Microsoft repository GPG keys and press Enter:

    sudo dpkg -i packages-microsoft-prod.deb

    Package Microsoft prod command
    Package Microsoft prod command
  4. Type the following command to update the list of products and press Enter:

    sudo apt-get update
  5. Type the following command to enable the “universe” repositories and press Enter:

    sudo add-apt-repository universe
  6. Type the following command to install PowerShell on Linux and press Enter:

    sudo apt-get install -y powershell

    Linux apt-get install PowerShell command
    Linux apt-get install PowerShell command

After you complete the steps, PowerShell will install on Ubuntu 18.04, and you can start it using the pwsh command.

When you no longer need the command line tool, use the sudo apt-get remove powershell command in the Terminal to uninstall it.

PowerShell dependencies

PowerShell builds portable binaries for all Linux distributions. However, Microsoft .NET Core runtime requires several dependencies on different flavors of Linux as well as PowerShell.

For example, on Ubuntu 18.04 and higher, the installation depends on libc6, libgcc1, libgssapi-krb5-2, liblttng-ust0, libstdc++6, libcurl3, libunwind8, libuuid1, zlib1g, libssl1.0.0, and libicu60.

If during the installation process, you come across dependency problems, you’ll have to find and install the components manually.

While preparing this guide, the installation of PowerShell 7 also required liblttng-ust0, libssl1.0.0, and libicu60. If you have the same issues, then you can get these packages with these commands:

  1. Open Terminal.

  2. Type the following command to install liblttng-ust0 and press Enter:

    sudo apt install liblttng-ust0
  3. Type the following command to download libicu60 and press Enter:

    wget http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu60_60.2-3ubuntu3.1_amd64.deb
  4. Type the following command to install libicu60 and press Enter:

    sudo dpkg -i libicu60_60.2-3ubuntu3.1_amd64.deb
  5. Type the following command to download libssl1.0.0 and press Enter:

    wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.3_amd64.deb
  6. Type the following command to install libicu60 and press Enter:

    sudo dpkg -i libssl1.0.0_1.0.2n-1ubuntu5.3_amd64.deb
  7. Type the following command to install PowerShell and Enter:

    sudo apt-get install -y powershell

Once you complete the steps, PowerShell 7 should install on your Linux device.

In case that you need to download a different version of the dependency packages, you can find them at the Ubuntu package repository.

About the author

Mauro Huculak is a Windows How-To Expert who started Pureinfotech in 2010 as an independent online publication. He has also been a Windows Central contributor for nearly a decade. Mauro has over 15 years of experience writing comprehensive guides and creating professional videos about Windows and software, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 21 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and About.me. Email him at [email protected].