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

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

To install package.
sudo dpkg -i packages-microsoft-prod.deb

To update the repository.
sudo apt-get update

Step 3: Installing PowerShell
Install PowerShell using the following command.
sudo apt-get install powershell -y

Step 4: Run PowerShell
Once the installation is complete, you can run PowerShell by typing.
pwsh
This will start the PowerShell session.

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.