In this article, we will have explained the necessary steps to install and configure Microsoft PowerShell on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
Microsoft PowerShell is a .net-based configuration management and automation tool initially developed by Microsoft for the Windows operating system. It consists of a cross-platform (Windows, Linux, and macOS) command-line shell and associated scripting language. By default, it is available on Windows 10 and 7. But we can install Powershell easily on Ubuntu 20.04 or earlier versions such as Ubuntu 18.04/16.04 using a single command.
Install Microsoft PowerShell on Ubuntu 20.04
Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.
sudo apt update sudo apt upgrade sudo apt install wget apt-transport-https software-properties-common
Step 2. Install Microsoft PowerShell on the Ubuntu system.
- Install Microsoft PowerShell from Snap.
To install the Microsoft PowerShell version you should execute the following command:
sudo apt install snap sudo snap install PowerShell --classic
- Install Microsoft PowerShell from the repository.
Now add the official Microsoft package repository on Ubuntu and install PowerShell from there using the APT package manager:
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb sudo apt update sudo apt install powershell
Now, to check whether PowerShell is working or not, run the following command:
Once successfully that PowerShell is installed, you can start it with the following command:
[email protected]:~# pwsh PowerShell 7.0.3 Copyright (c) Microsoft Corporation. All rights reserved.
That’s all you need to do to install Microsoft PowerShell on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on PowerShell, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.