Installing PowerShell on Debian Linux

All packages are available on our GitHub releases page. After the package is installed, run pwsh from a terminal. Run pwsh-preview if you installed a preview release. Before installing, check the list of Supported versions below.

Note

PowerShell 7.3 is an in-place upgrade that removes previous versions of PowerShell.

If you need to run PowerShell 7.3 side-by-side with a previous version, reinstall the previous version using the binary archive method.

Debian uses APT (Advanced Package Tool) as a package manager.

Installation via direct download

PowerShell 7.2 introduced a universal package that makes installation easier. Download the universal package from the releases page onto the Debian 10 machine. The link to the current version is:

  • PowerShell 7.3.7 - https://github.com/PowerShell/PowerShell/releases/download/v7.3.7/powershell_7.3.7-1.deb_amd64.deb
  • PowerShell 7.2.14 - https://github.com/PowerShell/PowerShell/releases/download/v7.2.14/powershell-lts_7.2.14-1.deb_amd64.deb

Installation on Debian 11 via Package Repository

PowerShell for Linux is published to package repositories for easy installation and updates.

The preferred method is as follows:

# Save the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --yes --dearmor --output /usr/share/keyrings/microsoft.gpg

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

# Install PowerShell
sudo apt update && sudo apt install -y powershell

# Start PowerShell
pwsh

Installation on Debian 10 via Package Repository

PowerShell for Linux is published to package repositories for easy installation and updates.

The preferred method is as follows:

# Download the Microsoft repository GPG keys
wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb

# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh

Uninstallation

sudo apt-get remove powershell

PowerShell paths

  • $PSHOME is /opt/microsoft/powershell/7/
  • User profiles are read from ~/.config/powershell/profile.ps1
  • Default profiles are read from $PSHOME/profile.ps1
  • User modules are read from ~/.local/share/powershell/Modules
  • Shared modules are read from /usr/local/share/powershell/Modules
  • Default modules are read from $PSHOME/Modules
  • PSReadLine history is 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.

Supported versions

The following table is a list of currently supported PowerShell releases and the versions of Debian they're supported on. These versions remain supported until either the version of PowerShell reaches end-of-support or the version of Debian reaches end-of-life.

  • The Supported icon indicates that the version of the OS or PowerShell is still supported
  • The Out of Support icon indicates the version of PowerShell is no longer supported on that version of the OS
  • The In Test icon indicates that we haven't finished testing PowerShell on that OS
  • The Not Supported icon indicates that the version of the OS or PowerShell isn't supported
  • When both the version of the OS and the version of PowerShell have a Supported icon, that combination is supported
Debian 7.2 (LTS-current) 7.3 7.4 (preview)
Supported 11 Supported Supported Supported
Supported 10 Supported Supported Supported

PowerShell is supported on Debian for the following processor architectures.

Debian 7.2 (LTS-current) 7.3 7.4 (preview)
Version 9+ x64 x64 x64

Installation support

Microsoft supports the installation methods in this document. There may be other methods of installation available from other third-party sources. While those tools and methods may work, Microsoft cannot support those methods.