Installing PowerShell Core on Linux

Supports Ubuntu 14.04, Ubuntu 16.04, Ubuntu 17.10, Debian 8, Debian 9, CentOS 7, Red Hat Enterprise Linux (RHEL) 7, OpenSUSE 42.2, Fedora 27, Fedora 28, and Arch Linux.

For Linux distributions that are not officially supported, you can try using the PowerShell AppImage. You can also try deploying PowerShell binaries directly using the Linux tar.gz archive, but you would need to set up the necessary dependencies based on the OS in separate steps.

All packages are available on our GitHub releases page. Once the package is installed, run pwsh from a terminal.

Installing Preview Releases

When installing a PowerShell Core Preview release for Linux via a Package Repository, the package name changes from powershell to powershell-preview.

Installing via direct download does not change, other than the file name.

Here is a table of the commands to install the stable and preview packages using the various package managers:

Distrobution(s) Stable Command Preview Command
Ubuntu, Debian sudo apt-get install -y powershell sudo apt-get install -y powershell-preview
CentOS, RedHat sudo yum install -y powershell sudo yum install -y powershell-preview
OpenSUSE sudo zypper install powershell sudo zypper install powershell-preview
Fedora sudo dnf install -y powershell sudo dnf install -y powershell-preview

Ubuntu 14.04

Installation via Package Repository - Ubuntu 14.04

PowerShell Core, for Linux, is published to package repositories for easy installation (and updates). This is the preferred method.

# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft Ubuntu repository
curl https://packages.microsoft.com/config/ubuntu/14.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh

As superuser, register the Microsoft repository. From then on, you just need to use sudo apt-get upgrade powershell to update the installation.

Installation via Direct Download - Ubuntu 14.04

Download the Debian package powershell_6.0.2-1.ubuntu.14.04_amd64.deb from the releases page onto the Ubuntu machine.

Then execute the following in the terminal:

sudo dpkg -i powershell_6.0.2-1.ubuntu.14.04_amd64.deb
sudo apt-get install -f

Note

The dpkg -i command fails with unmet dependencies. The next command, apt-get install -f resolves these issues then finishes configuring the PowerShell package.

Uninstallation - Ubuntu 14.04

sudo apt-get remove powershell

Ubuntu 16.04

Installation via Package Repository - Ubuntu 16.04

PowerShell Core, for Linux, is published to package repositories for easy installation (and updates). This is the preferred method.

# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft Ubuntu repository
sudo curl -o /etc/apt/sources.list.d/microsoft.list https://packages.microsoft.com/config/ubuntu/16.04/prod.list

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh

After registering the Microsoft repository once as superuser, from then on, you just need to use sudo apt-get upgrade powershell to update it.

Installation via Direct Download - Ubuntu 16.04

Download the Debian package powershell_6.0.2-1.ubuntu.16.04_amd64.deb from the releases page onto the Ubuntu machine.

Then execute the following in the terminal:

sudo dpkg -i powershell_6.0.2-1.ubuntu.16.04_amd64.deb
sudo apt-get install -f

Note

The dpkg -i command fails with unmet dependencies. The next command, apt-get install -f resolves these issues then finishes configuring the PowerShell package.

Uninstallation - Ubuntu 16.04

sudo apt-get remove powershell

Ubuntu 17.10

Note

Support for Ubuntu 17.04 was added after 6.1.0-preview.2

Installation via Package Repository - Ubuntu 17.10

PowerShell Core, for Linux, is published to package repositories for easy installation (and updates). This is the preferred method.

# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft Ubuntu repository
sudo curl -o /etc/apt/sources.list.d/microsoft.list https://packages.microsoft.com/config/ubuntu/17.10/prod.list

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh

After registering the Microsoft repository once as superuser, from then on, you just need to use sudo apt-get upgrade powershell to update it.

Installation via Direct Download - Ubuntu 17.10

Download the Debian package powershell_6.0.2-1.ubuntu.17.10_amd64.deb from the releases page onto the Ubuntu machine.

Then execute the following in the terminal:

sudo dpkg -i powershell_6.0.2-1.ubuntu.17.10_amd64.deb
sudo apt-get install -f

Note

The dpkg -i command fails with unmet dependencies. The next command, apt-get install -f resolves these issues then finishes configuring the PowerShell package.

Uninstallation - Ubuntu 17.10

sudo apt-get remove powershell

Ubuntu 18.04

Note

Support for Ubuntu 18.04 was added after 6.1.0-preview.2

Installation via Package Repository - Ubuntu 18.04

PowerShell Core, for Linux, is published to package repositories for easy installation (and updates). This is the preferred method.

# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft Ubuntu repository
sudo curl -o /etc/apt/sources.list.d/microsoft.list https://packages.microsoft.com/config/ubuntu/18.04/prod.list

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell-preview

# Start PowerShell
pwsh

After registering the Microsoft repository once as superuser, from then on, you just need to use sudo apt-get upgrade powershell to update it.

Installation via Direct Download - Ubuntu 18.04

Download the Debian package powershell_6.1.0-preview.3-1.ubuntu.18.04_amd64.deb from the releases page onto the Ubuntu machine.

Then execute the following in the terminal:

sudo dpkg -i powershell_6.1.0-preview.3-1.ubuntu.18.04_amd64.deb
sudo apt-get install -f

Note

The dpkg -i command fails with unmet dependencies. The next command, apt-get install -f resolves these issues then finishes configuring the PowerShell package.

Uninstallation - Ubuntu 17.10

sudo apt-get remove powershell

Debian 8

Installation via Package Repository - Debian 8

PowerShell Core, for Linux, is published to package repositories for easy installation (and updates). This is the preferred method.

# Install system components
sudo apt-get update
sudo apt-get install curl apt-transport-https

# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft Product feed
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-jessie-prod jessie main" > /etc/apt/sources.list.d/microsoft.list'

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh

After registering the Microsoft repository once as superuser, from then on, you just need to use sudo apt-get upgrade powershell to update it.

Installation via Direct Download - Debian 8

Download the Debian package powershell_6.0.2-1.debian.8_amd64.deb from the releases page onto the Debian machine.

Then execute the following in the terminal:

sudo dpkg -i powershell_6.0.2-1.debian.8_amd64.deb
sudo apt-get install -f

Note

The dpkg -i command fails with unmet dependencies. The next command, apt-get install -f resolves these issues then finishes configuring the PowerShell package.

Uninstallation - Debian 8

sudo apt-get remove powershell

Debian 9

Installation via Package Repository - Debian 9

PowerShell Core, for Linux, is published to package repositories for easy installation (and updates). This is the preferred method.

# Install system components
sudo apt-get update
sudo apt-get install curl gnupg apt-transport-https

# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft Product feed
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list'

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh

After registering the Microsoft repository once as superuser, from then on, you just need to use sudo apt-get upgrade powershell to update it.

Installation via Direct Download - Debian 9

Download the Debian package powershell_6.0.2-1.debian.9_amd64.deb from the releases page onto the Debian machine.

Then execute the following in the terminal:

sudo dpkg -i powershell_6.0.2-1.debian.9_amd64.deb
sudo apt-get install -f

Uninstallation - Debian 9

sudo apt-get remove powershell

CentOS 7

Note

This package also works on Oracle Linux 7.

Installation via Package Repository (preferred) - CentOS 7

PowerShell Core for Linux is published to official Microsoft repositories for easy installation (and updates).

# Register the Microsoft RedHat repository
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo

# Install PowerShell
sudo yum install -y powershell

# Start PowerShell
pwsh

After registering the Microsoft repository once as superuser, you just need to use sudo yum update powershell to update PowerShell.

Installation via Direct Download - CentOS 7

Using CentOS 7, download the RPM package powershell-6.0.2-1.rhel.7.x86_64.rpm from the releases page onto the CentOS machine.

Then execute the following in the terminal:

sudo yum install powershell-6.0.2-1.rhel.7.x86_64.rpm

You can also install the RPM without the intermediate step of downloading it:

sudo yum install https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/powershell-6.0.2-1.rhel.7.x86_64.rpm

Uninstallation - CentOS 7

sudo yum remove powershell

Red Hat Enterprise Linux (RHEL) 7

Installation via Package Repository (preferred) - Red Hat Enterprise Linux (RHEL) 7

PowerShell Core for Linux is published to official Microsoft repositories for easy installation (and updates).

# Register the Microsoft RedHat repository
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo

# Install PowerShell
sudo yum install -y powershell

# Start PowerShell
pwsh

After registering the Microsoft repository once as superuser, you just need to use sudo yum update powershell to update PowerShell.

Installation via Direct Download - Red Hat Enterprise Linux (RHEL) 7

Download the RPM package powershell-6.0.2-1.rhel.7.x86_64.rpm from the releases page onto the Red Hat Enterprise Linux machine.

Then execute the following in the terminal:

sudo yum install powershell-6.0.2-1.rhel.7.x86_64.rpm

You can also install the RPM without the intermediate step of downloading it:

sudo yum install https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/powershell-6.0.2-1.rhel.7.x86_64.rpm

Uninstallation - Red Hat Enterprise Linux (RHEL) 7

sudo yum remove powershell

OpenSUSE 42.2

When installing PowerShell Core, zypper may report the following error:

Problem: nothing provides libcurl needed by powershell-6.0.1-1.rhel.7.x86_64
 Solution 1: do not install powershell-6.0.1-1.rhel.7.x86_64
 Solution 2: break powershell-6.0.1-1.rhel.7.x86_64 by ignoring some of its dependencies

In this case, verify that a compatible libcurl library is present by checking that the following command shows the libcurl4 package as installed:

zypper search --file-list --match-exact '/usr/lib64/libcurl.so.4'

Then choose the break powershell-6.0.1-1.rhel.7.x86_64 by ignoring some of its dependencies solution when installing the PowerShell package.

Installation via Package Repository (preferred) - OpenSUSE 42.2

PowerShell Core for Linux is published to official Microsoft repositories for easy installation (and updates).

# Register the Microsoft signature key
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

# Add the Microsoft Product feed
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/zypp/repos.d/microsoft.repo

# Update the list of products
sudo zypper update

# Install PowerShell
sudo zypper install powershell

# Start PowerShell
pwsh

Installation via Direct Download - OpenSUSE 42.2

Download the RPM package powershell-6.0.2-1.rhel.7.x86_64.rpm from the releases page onto the OpenSUSE machine.

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo zypper install powershell-6.0.2-1.rhel.7.x86_64.rpm

You can also install the RPM without the intermediate step of downloading it:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo zypper install https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/powershell-6.0.2-1.rhel.7.x86_64.rpm

Uninstallation - OpenSUSE 42.2

sudo zypper remove powershell

Fedora

Note

Fedora 28 is only supported in PowerShell Core 6.1 and newer.

Installation via Package Repository (preferred) - Fedora 27, Fedora 28

PowerShell Core for Linux is published to official Microsoft repositories for easy installation (and updates).

# Register the Microsoft signature key
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

# Register the Microsoft RedHat repository
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo

# Update the list of products
sudo dnf update

# Install a system component
sudo dnf install compat-openssl10

# Install PowerShell
sudo dnf install -y powershell

# Start PowerShell
pwsh

Installation via Direct Download - Fedora 27, Fedora 28

Download the RPM package powershell-6.0.2-1.rhel.7.x86_64.rpm from the releases page onto the Fedora machine.

Then execute the following in the terminal:

sudo dnf install compat-openssl10
sudo dnf install powershell-6.0.2-1.rhel.7.x86_64.rpm

You can also install the RPM without the intermediate step of downloading it:

sudo dnf install compat-openssl10
sudo dnf install https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/powershell-6.0.2-1.rhel.7.x86_64.rpm

Uninstallation - Fedora 27, Fedora 28

sudo dnf remove powershell

Arch Linux

Note

Arch support is experimental.

PowerShell is available from the Arch Linux User Repository (AUR).

Packages in the AUR are community maintained - there is no official support.

For more information on installing packages from the AUR, see the Arch Linux wiki or the community DockerFile.

Linux AppImage

Note

AppImage support is experimental

Using a recent Linux distribution, download the AppImage powershell-6.0.1-x86_64.AppImage from the releases page onto the Linux machine.

Then execute the following in the terminal:

chmod a+x powershell-6.0.1-x86_64.AppImage
./powershell-6.0.1-x86_64.AppImage

The AppImage lets you run PowerShell without installing it. It is a portable application that bundles PowerShell and its dependencies (including .NET Core's system dependencies) into one cohesive package. This package is a single binary that works independently of the user's Linux distribution.

Kali

Note

Kali support is experimental.

Installation

# Download & Install prerequisites
sudo apt-get install libunwind8 libicu55
wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u6_amd64.deb
sudo dpkg -i libssl1.0.0_1.0.1t-1+deb8u6_amd64.deb

# Install PowerShell
sudo dpkg -i powershell_6.0.2-1.ubuntu.16.04_amd64.deb

# Start PowerShell
pwsh

Run PowerShell in latest Kali (Kali GNU/Linux Rolling) without installing it

# Grab the latest App Image
wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/powershell-6.0.2-x86_64.AppImage

# Make executable
chmod a+x powershell-6.0.2-x86_64.AppImage

# Start PowerShell
./powershell-6.0.2-x86_64.AppImage

Uninstallation - Kali

sudo dpkg -r powershell_6.0.2-1.ubuntu.16.04_amd64.deb

Raspbian

Note

Raspbian support is experimental.

Currently, PowerShell is only supported on Raspbian Stretch.

Also CoreCLR (and thus PowerShell Core) will only work on Pi 2 and Pi 3 devices as other devices, like Pi Zero, have an unsupported processor.

Download Raspbian Stretch and follow the installation instructions to get it onto your Pi.

Installation

# Install prerequisites
sudo apt-get install libunwind8

# Grab the latest tar.gz
wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/powershell-6.0.2-linux-arm32.tar.gz

# Make folder to put powershell
mkdir ~/powershell

# Unpack the tar.gz file
tar -xvf ./powershell-6.0.2-linux-arm32.tar.gz -C ~/powershell

# Start PowerShell
~/powershell/pwsh

Optionally you can create a symbolic link to be able to start PowerShell without specifying path to the "pwsh" binary

# Start PowerShell from bash with sudo to create a symbolic link
sudo ~/powershell/pwsh -c New-Item -ItemType SymbolicLink -Path "/usr/bin/pwsh" -Target "\$PSHOME/pwsh" -Force

# alternatively you can run following to create a symbolic link
# sudo ln -s ~/powershell/pwsh /usr/bin/pwsh

# Now to start PowerShell you can just run "pwsh"

Uninstallation - Raspbian

rm -rf ~/powershell

Binary Archives

PowerShell binary tar.gz archives are provided for Linux platforms to enable advanced deployment scenarios.

Dependencies

PowerShell builds portable binaries for all Linux distributions. But .NET Core runtime requires different dependencies on different distributions, and hence PowerShell does the same.

The following chart shows the .NET Core 2.0 dependencies that are officially supported on different Linux distributions.

OS Dependencies
Ubuntu 14.04 libc6, libgcc1, libgssapi-krb5-2, liblttng-ust0, libstdc++6,
libcurl3, libunwind8, libuuid1, zlib1g, libssl1.0.0, libicu52
Ubuntu 16.04 libc6, libgcc1, libgssapi-krb5-2, liblttng-ust0, libstdc++6,
libcurl3, libunwind8, libuuid1, zlib1g, libssl1.0.0, libicu55
Ubuntu 17.10 libc6, libgcc1, libgssapi-krb5-2, liblttng-ust0, libstdc++6,
libcurl3, libunwind8, libuuid1, zlib1g, libssl1.0.0, libicu57
Ubuntu 18.04 libc6, libgcc1, libgssapi-krb5-2, liblttng-ust0, libstdc++6,
libcurl3, libunwind8, libuuid1, zlib1g, libssl1.0.0, libicu60
Debian 8 (Jessie) libc6, libgcc1, libgssapi-krb5-2, liblttng-ust0, libstdc++6,
libcurl3, libunwind8, libuuid1, zlib1g, libssl1.0.0, libicu52
Debian 9 (Stretch) libc6, libgcc1, libgssapi-krb5-2, liblttng-ust0, libstdc++6,
libcurl3, libunwind8, libuuid1, zlib1g, libssl1.0.2, libicu57
CentOS 7
Oracle Linux 7
RHEL 7
OpenSUSE 42.2
libunwind, libcurl, openssl-libs, libicu
Fedora 27
Fedora 28
libunwind, libcurl, openssl-libs, libicu, compat-openssl10

To deploy PowerShell binaries on Linux distributions that are not 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 Linux tar.gz archive.

Installation - Binary Archives

Linux

# Download the powershell '.tar.gz' archive
curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/powershell-6.0.2-linux-x64.tar.gz

# Create the target folder where powershell will be placed
sudo mkdir -p /opt/microsoft/powershell/6.0.2

# Expand powershell to the target folder
sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/6.0.2

# Set execute permissions
sudo chmod +x /opt/microsoft/powershell/6.0.2/pwsh

# Create the symbolic link that points to pwsh
sudo ln -s /opt/microsoft/powershell/6.0.2/pwsh /usr/bin/pwsh

Uninstalling binary archives

sudo rm -rf /usr/bin/pwsh /opt/microsoft/powershell

Paths

  • $PSHOME is /opt/microsoft/powershell/6.0.2/
  • User profiles will be read from ~/.config/powershell/profile.ps1
  • Default profiles will be read from $PSHOME/profile.ps1
  • User modules will be read from ~/.local/share/powershell/Modules
  • Shared modules will be read from /usr/local/share/powershell/Modules
  • Default modules will be read from $PSHOME/Modules
  • PSReadline history will be recorded to ~/.local/share/powershell/PSReadLine/ConsoleHost_history.txt

The profiles respect PowerShell's per-host configuration, so the default host-specific profiles exists at Microsoft.PowerShell_profile.ps1 in the same locations.

PowerShell respects the XDG Base Directory Specification on Linux.