Arabic Arabic Chinese (Simplified) Chinese (Simplified) Dutch Dutch English English French French German German Italian Italian Portuguese Portuguese Russian Russian Spanish Spanish
| (844) 627-8267
0

How to Install PowerShell on Ubuntu 22.04 LTS | #linux | #linuxsecurity | #hacking | #aihp



In this tutorial, we learn the steps to install Microsoft Windows PowerShell in Ubuntu 22.04 Jammy JellyFish Linux using the command terminal.

Windows PowerShell is both a command-line shell and a scripting language with more than 130 command-line utilities called cmdlets (command-lets) that follow extremely consistent syntax and naming conventions and can be extended with custom cmdlets .

Instructions are issued using cmdlets. A cmdlet is a single feature for manipulating an object. They use a verb-noun syntax, meaning a verb and a noun separated by a hyphen. Parameters are marked with a preceding “-“.

PowerShell is an object-oriented shell, which means that the input and output of commands are usually objects. The connection of commands is represented by the so-called ” pipe ” command: ” |”. You can read detailed information about the pipeline and its application here.

Earlier Microsoft Windows PowerShell was only a Windows software but later it was made open-source and cross-platform by its developers on 18 August 2016. The former is built on the .NET Framework, the latter on .NET Core.

 

Steps to install Microsoft PowerShell in Ubuntu 22.04 LTS

The steps are given here can be used on Ubuntu 20.04 LTS Focal Fossa and other versions as well. Including other Debian and Ubuntu-based Linux OS such as Linux Mint, Elementary, MX Linux, Kali, and more…

#1ste method using Snap

1. Use Snap to insall PowerShell

The best way to install Powershell is to use pre-installed Snap package manager on Ubuntu operating systems. This universal package manager is enabled by default on the system and can be used to easily install popular software. Hence, run:

sudo snap install powershell --classic

 

#2nd method using APT 

2. Update Ubuntu 22.04

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

 

3. Add Powershell repository on Ubuntu 22.04

Well, even though the Microsoft Powershell is open source but it is not available to install via the Ubuntu’s official repository. Hence, we have to add the repo officially offered by the developers of this software.

echo "deb [arch=amd64,armhf,arm64 signed-by=/usr/share/keyrings/powershell.gpg] \
https://packages.microsoft.com/ubuntu/20.04/prod focal main" \
| sudo tee /etc/apt/sources.list.d/powershell.list

4. Add GPG Key

To authenticate the packages we will recieve 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 | gpg --dearmor | sudo tee /usr/share/keyrings/powershell.gpg >/dev/null

Run system upate, again to refresh the APT cache:

sudo apt update

 

5. Install Microsoft PowerShell on Ubuntu 22.04

Well, we have configured all the things we required to install PowerShell on Ubuntu and other similar Linux systems. Now, let’s use the APT package manager and setup PowerShell.

sudo apt install powershell -y

 

6. Start the Powershell

To run the powershell go to Application launcher and search for “Powershell“, as it icon appears, click to run the same. Alternatively, you can directly switch to it from your terminal by typing – powershell

 

7. How to update/upgrade

In future, if you want to download and install the latest version of Powershell in future, then use the one of the given commands as per the method you have used to install it.

For Snap:

sudo snap refresh powershell

For APT method

sudo apt update && sudo apt upgrade

 

8. 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.

For snap

sudo snap remove powershell

For APT:

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

 

Ending note:

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. For more infromation visit the offcial website.

 

Other Articles:

How to install Microsoft Powershell on Ubuntu 20.04 LTS
Install Microsoft Edge browser on Ubuntu 20.04 LTS
How to install Microsoft Office 2007 on Ubuntu 20.04 LTS

 

 

Click Here For The Original Source.


-------------------------------------------------------------------------------------

Translate

Arabic Arabic Chinese (Simplified) Chinese (Simplified) Dutch Dutch English English French French German German Italian Italian Portuguese Portuguese Russian Russian Spanish Spanish