Jul 2, 2024 4 min read

How to Install PowerShell on Debian 11

Install PowerShell on Debian 11 with our step-by-step tutorial. PowerShell is a versatile command-line shell and scripting language.

Install PowerShell on Debian 11
Install PowerShell on Debian 11
Table of Contents

Introduction

Before we begin talking about how to install PowerShell on Debian 11, let's briefly understand – What is PowerShell?

PowerShell is a powerful and versatile command-line shell and scripting language developed by Microsoft. It allows users to automate various tasks and manage system configurations on Windows operating systems. With its scripting capabilities, PowerShell enables the creation of complex automation scripts to streamline administrative tasks.

By combining commands and scripts, PowerShell provides a flexible and efficient tool for system administrators and developers. Its broad range of features and ease of use make it an essential tool for managing and controlling Windows environments.

In this tutorial, you will install PowerShell on Debian 11. We will also address a few FAQs on how to install PowerShell on Debian 11.

Advantages of PowerShell

  1. Automation: PowerShell enables automation of repetitive tasks, saving time and effort for system administrators.
  2. Scripting: Its robust scripting language allows the creation of complex scripts for advanced system management.
  3. Integration: PowerShell seamlessly integrates with other Microsoft products and technologies, enhancing compatibility and productivity.
  4. Remote management: Administrators can manage remote systems and execute commands from a central location.
  5. Extensibility: PowerShell's extensibility allows the addition of custom modules, making it adaptable to specific needs and expanding functionality.

Steps to install Windows PowerShell on Debian 11 Bullseye

The instructions provided here also work with other Linux operating systems that are built on top of Debian 11 Bullseye, like MX Linux, which includes Linux Mint, Elementary OS, Debian, and others.

1. Update Debian 11 Bullseye

To install the most recent security and other updates, run the system update command first. Additionally, the Apt package manager cache will be refreshed.

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

Despite being open source, Microsoft Powershell cannot be installed through the official Debian repository. Therefore, we must include the repository that the software's developers have formally made available.

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

We must add the GPG key used to sign the packages in order to verify that the packages we will receive through our recently added PowerShell repository are exactly as their developers have published them.

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

Refresh the APT cache by running system update once more:

sudo apt update

4. Install Microsoft PowerShell on Debian 11

All the necessary configurations have been completed for PowerShell to be installed on Debian and other comparable Linux systems. Let's install PowerShell and use the APT package manager now.

sudo apt install powershell -y

5. Start the Powershell

Run the following command in your command terminal as soon as the installation is finished to convert Bash to Powershell:

pwsh
Install PowerShell on Debian 11 Bullseye Linux

6. How to update/upgrade

Use one of the provided commands in accordance with the installation method you used if you wish to download and install the most recent version of Powershell in the future.

sudo apt update && sudo apt upgrade

7. Uninstall or Remove Linux Powershell

This command line software is easily removeable by those who do not want it. Use the same procedure that you used to install the program to remove it once more.

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

FAQs to Install PowerShell on Debian 11

What are the system requirements for installing PowerShell on Debian 11? 

PowerShell requires a 64-bit distribution of Debian 11 with a minimum version of 11.1 and a kernel version of 4.19 or later.

Can I install PowerShell on both desktop and server versions of Debian 11? 

Yes, you can install PowerShell on both desktop and server versions of Debian 11 by following the same installation process.

Are there any dependencies or prerequisites for installing PowerShell on Debian 11? 

Yes, PowerShell has some dependencies such as libicu and libssl that need to be installed before installing PowerShell.

How can I update PowerShell to the latest version on Debian 11? 

You can update PowerShell to the latest version by running the package manager's update command to fetch the latest version from the repository.

Can I use PowerShell on Debian 11 to manage remote Windows systems? 

Yes, PowerShell on Debian 11 has the capability to manage remote Windows systems using the appropriate PowerShell remoting commands.

Does PowerShell on Debian 11 support cross-platform scripting? 

Yes, PowerShell on Debian 11 supports cross-platform scripting, allowing you to write scripts that work seamlessly across different operating systems, including Windows, Linux, and macOS.

Is PowerShell on Debian 11 open-source?

Yes, PowerShell is open-source on Linux, including Debian 11. You can contribute to its development or explore its source code on GitHub.

Conclusion

We hope this tutorial helped you understand how to install PowerShell on Debian 11.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.