How to Install PowerShell on Debian


PowerShell is an open-source cross-platform task automation tool that allows users to automate and manage their tasks from the command line. It is available for Linux, Windows, and macOS. In this post, we will describe how you can install it on Debian. On Debian, you can install PowerShell through the following two methods:

  • Via apt
  • Via Snap

Installing PowerShell on Debian via apt (Debian 11)

PowerShell is available in the package repositories of Debian systems and can be installed through Apt. Complete the below steps to install PowerShell using Apt:

1. Update the packages list and install some pre-requisites using the commands below:

$ sudo apt update 
$ sudo apt install -y curl gnupg apt-transport-https

2. Add the GPG key for the Microsoft repository using the command below:

$ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

3. Now add the repository into your system using the command below:

$ sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list'

4. Then use the command below to update the packages list:

$ sudo apt update

5. Now in order to install PowerShell, use the command below:

$ sudo apt install powershell

Install-Anaconda-Ubuntu-22-04

To launch PowerShell, use the command below:

$ pwsh

Your Terminal prompt will now change to PS.

Installing PowerShell on Debian via Apt (For Debian 10)

You can also install PowerShell by downloading the deb package available on the PowerShell GitHub page and then installing it through dpkg. Complete the below steps to install PowerShell using dpkg:

1. Download the GPG keys for the Microsoft repository using the command below:

$ wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb

2. Now register the keys using the command below:

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

Install-Anaconda-Ubuntu-22-04

3. Then run the command below to update the packages list:

$ sudo apt-get update

4. Now you can install PowerShell on your Debian system using the command below:

$ sudo apt-get install -y powershell


To launch PowerShell, use the command below:

$ pwsh

Your Terminal prompt will now change to PS.

Installing PowerShell on Debian via Snap

You can also install PowerShell’s latest stable version using snap. Complete the below steps in order to install PowerShell on Debian using snap:

1. Use the command below to install snapd on your system:

$ sudo apt install snapd

2. Then use this command to install PowerShell:

$ sudo snap install powershell --classic

Install-Anaconda-Ubuntu-22-04

To launch PowerShell, use the command below:

$ pwsh

Your Terminal prompt will now change to PS.

Remove PowerShell from Debian

Based on how you installed PowerShell on your Debian system, there are two ways to remove it.

If you installed PowerShell through Apt, here is the command to remove it:

$ sudo apt remove powershell 

If you installed PowerShell through Snap, here is the command to remove it:

$ sudo snap remove powershell

PowerShell saves time and reduces the workload of administrators by letting them automate and manage different tasks. Using any of the installation methods described in this post, you should now be able to install PowerShell on your Debian system. For Ubuntu OS, visit our post on how to install PowerShell on Ubuntu.

Print Friendly, PDF & Email
Categories