Introduction
PowerShell is a task automation framework and a scripting language developed by Microsoft. It is designed specifically for system administration and automation purposes, providing a command-line shell and a scripting language that enables users to automate administrative tasks on both Windows and, to some extent, other operating systems.
Prerequisites
- Up and running ubuntu 22.04 LTS machine.
- Basic knowledge in linux commands.
- Internet connectivity.
In this post, We will show you how to install Powershell on ubuntu 22.04 LTS linux machine.
Step 1: Run System Update
We need to use the given command to upgrade the default package on ubuntu 22.04 LTS machine.
sudo apt-get update
![](https://www.devopstricks.in/wp-content/uploads/2023/12/image-7-1024x128.png)
Step 2: Add Microsoft Repository
Open a terminal and run the following commands to import the Microsoft GPG key and add the official Microsoft repository.
To download the package.
wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
![](https://www.devopstricks.in/wp-content/uploads/2023/12/image-8.png)
To install package.
sudo dpkg -i packages-microsoft-prod.deb
![](https://www.devopstricks.in/wp-content/uploads/2023/12/image-9-1024x157.png)
To update the repository.
sudo apt-get update
![](https://www.devopstricks.in/wp-content/uploads/2023/12/image-10.png)
Step 3: Installing PowerShell
Install PowerShell using the following command.
sudo apt-get install powershell -y
![](https://www.devopstricks.in/wp-content/uploads/2023/12/image-11-1024x304.png)
Step 4: Run PowerShell
Once the installation is complete, you can run PowerShell by typing.
pwsh
This will start the PowerShell session.
![](https://www.devopstricks.in/wp-content/uploads/2023/12/image-12.png)
Conclusion
We have successfully install PowerShell on ubuntu 22.04 LTS machine, If you still have questions, please post them in the comments section below.