Alternate ways to install PowerShell on Linux
All packages are available on our GitHub releases page. After the package is installed,
pwsh from a terminal. Run
pwsh-preview if you installed a preview release.
There are three other ways to install PowerShell on a Linux distribution:
Snaps are application packages that are easy to install, secure, cross‐platform and dependency‐free. Snaps are discoverable and installable from the Snap Store. Snap packages are supported the same as the distribution you're running the package on.
The Snap Store contains PowerShell snap packages for many Linux distributions that are not officially supported by Microsoft. For support, see the list of available Community Support options.
snapd is required to run snaps. Use these instructions
to make sure you have
Installation via Snap
PowerShell for Linux is published to the Snap store for easy installation and updates.
The preferred method is as follows:
# Install PowerShell sudo snap install powershell --classic # Start PowerShell pwsh
To install the latest LTS version, use the following method:
# Install PowerShell sudo snap install powershell --channel=lts/stable --classic # Start PowerShell pwsh
To install a preview version, use the following method:
# Install PowerShell sudo snap install powershell-preview --classic # Start PowerShell pwsh-preview
After installation, Snap will automatically upgrade. You can trigger an upgrade using
sudo snap refresh powershell or
sudo snap refresh powershell-preview.
sudo snap remove powershell
sudo snap remove powershell-preview
tar.gz archives are provided for Linux platforms to enable advanced deployment
You can use this method to install any version of PowerShell including the latest:
PowerShell builds portable binaries for all Linux distributions. But, .NET Core runtime requires different dependencies on different distributions, and PowerShell does too.
It's possible that when you install PowerShell, specific dependencies may not be installed, such as when manually installing from the binary archives. The following list details Linux distributions that are supported by Microsoft and have dependencies you may need to install. Check the distribution page for more information:
To deploy PowerShell binaries on Linux distributions that aren't officially supported, you need to
install the necessary dependencies for the target OS in separate steps. For example, our
Amazon Linux dockerfile installs dependencies first, and then extracts the
Installation using a binary archive file
This method can be used to install PowerShell on any version of Linux, including distributions that are not officially supported by Microsoft. Be sure to install any necessary dependencies. For support, see the list of available Community Support options.
The following example shows the steps for installing the x64 binary archive. You must choose the correct binary archive that matches the processor type for your platform.
Use the following shell commands to download and install PowerShell from the
archive. Change the URL to match the version of PowerShell you want to install.
# Download the powershell '.tar.gz' archive curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v7.3.0/powershell-7.3.0-linux-x64.tar.gz # Create the target folder where powershell will be placed sudo mkdir -p /opt/microsoft/powershell/7 # Expand powershell to the target folder sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7 # Set execute permissions sudo chmod +x /opt/microsoft/powershell/7/pwsh # Create the symbolic link that points to pwsh sudo ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh
Uninstalling binary archives
sudo rm -rf /usr/bin/pwsh /opt/microsoft/powershell
Install as a .NET Global tool
dotnet tool install --global PowerShell
The dotnet tool installer adds
~/.dotnet/tools to your
PATH environment variable. However, the
currently running shell does not have the updated
PATH. You should be able to start PowerShell
from a new shell by typing
Submit and view feedback for