Learn the commands to install the Microsoft Powershell command-line tool on Debian 11 Bullseye Linux using the terminal.
Whether for server administration or system management, PowerShell can certainly be understood as the successor to the CMD function (command prompt). It basically does the same thing (control Windows via text input), just has a lot more features to offer. In contrast to the command prompt, PowerShell is a complete scripting environment that can be used to create entire scripts for controlling Windows systems. In other words, it is an interactive command-line interface that can be used to automate numerous tasks. However, it is not limited to Windows only, because Microsoft already made this Windows exclusive software open source and cross-platform. Hence, we can install it on all major Linux operating systems.
With PowerShell, you can start both simple commands (e.g. display the current time) and very complex applications (e.g. automation solutions). The combination of several commands is also possible (“pipelining”). Alternatively, even self-developed commands can be built into the console.
Steps to install Windows PowerShell on Debian 11 Bullseye
The steps are given here also applicable for other Linux operating systems based on Debian 11 Bullseye such as MX Linux including Linux Mint, Elementary OS, Debian, and more…
1. Update Debian 11 Bullseye
First, perform the system update command that will install the latest available security and other updates. This will also refresh the Apt package manager cache.
sudo apt update && sudo apt upgrade
Also install curl, gnupg2, and HTTPS support:
sudo apt install curl apt-transport-https gnupg2 -y
2. Add Powershell repository on Debian 11
Well, even though Microsoft Powershell is open source but it is not available to install via Debian’s official repository. Hence, we have to add the repo officially offered by the developers of this software.
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'
3. Add GPG Key
To authenticate the packages we will receive through our newly added PowerShell repository are as they were published by its developers, we need to add the GPG key used to sign the packages.
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
Run system update, again to refresh the APT cache:
sudo apt update
4. Install Microsoft PowerShell on Debian 11
Well, we have configured all the things we required to install PowerShell on Debian and other similar Linux systems. Now, let’s use the APT package manager and set up PowerShell.
sudo apt install powershell -y
5. Start the Powershell
Once the installation is completed, directly run the given command in your command terminal and it will switch the bash to Powershell:
6. How to update/upgrade
In the future, if you want to download and install the latest version of Powershell in future, then use one of the given commands as per the method you have used to install it.
sudo apt update && sudo apt upgrade
7. Uninstall or Remove Linux Powershell
Those who don’t want this command line software can remove it easily. Again the method you have chosen to install the software, use the same to uninstall it.
sudo apt remove powershell
Also, remove Repository
sudo rm /etc/apt/sources.list.d/powershell.list sudo rm /etc/apt/sources.list.d/microsoft-prod.list
Many problems can be easily solved with Windows Powershell. And it offers more options than the classic command-line CMD. Know more about the PowerShell Command line at the Microsoft Doc page.
• How to Install PowerShell on Ubuntu 22.04 LTS
• Install phpBB forum on Debian 11 Bullseye
• Install VSCodium on Debian 11 Bullseye Linux
• Install Backdrop CMS on Debian 11 Bullseye