How to install Microsoft PowerShell on Linux

If you need to do task automation based on the Redmond giant software, know and see how to install Microsoft PowerShell on Linux.

PowerShell is a task management and automation management system developed by Microsoft.

How to install Microsoft PowerShell on Linux
How to install Microsoft PowerShell on Linux

It includes a command-line shell and a framework for processing cmdlets. In addition, it is a very powerful object-oriented scripting language, with classes and methods, built on the .NET Framework.

Originally, it was a Windows-only component, which was later opened and became multiplatform on August 18, 2016, making it available for both Linux and Mac OS.

Powershell provides full access to WS-Management and Common Information Model (CIM) that enable remote Linux systems and network devices to be administered .

In this tool, administrative tasks are basically performed by specific .NET classes called cmdlets.

Similar to shell scripts in Linux, users can create scripts or executables by storing groups of cmdlets in files by following certain rules.

These scripts can be used as stand-alone command-line utilities.

In addition, it includes its own extensive console-based help (similar to man pages on the Linux command line) accessible through the Get-Help cmdlet. You can type get-help on the Powershell console.

To complete, the local help content can be retrieved from the Internet through Update-Help cmdlet Update-Help on the console.

How to install Microsoft PowerShell on Linux

To install Microsoft PowerShell on Linux, simply use one of the procedures below to do the installation of Powershell on the most popular Linux distributions.

How to install Microsoft PowerShell on Linux Ubuntu and derivatives

To install Microsoft PowerShell on Ubuntu Linux and derivatives and still be able to automatically receive future upgrades from it, you must do the following:

Step 1. Open a terminal (in Unity use the CTRL + ALT + T keys); 
Step 2. If you do not already have it, add the program repository with these commands or use this tutorial ;

wget -q -O - https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
wget -q -O - https://packages.microsoft.com/config/ubuntu/17.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list

Step 3. Update the package manager with the command:

sudo apt-get update

Step 4. Now use the command below to install the program;

sudo apt-get install powershell -y

How to install Microsoft PowerShell on Linux Debian and derivatives

To install Microsoft PowerShell on Linux Debian and derivatives and still be able to automatically receive future updates from it, you must do the following:

Step 1. Open a terminal; 
Step 2. If you do not already have it, install the dependencies and add the program repository with these commands;

apt-get install curl gnupg apt-transport-https
wget -q -O - https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list'

Step 3. Update the package manager with the command:

sudo apt-get update

Step 4. Now use the command below to install the program;

sudo apt-get install powershell -y

How to install Microsoft PowerShell on Linux Fedora and derivatives

To install Microsoft PowerShell on Linux Fedora and its derivatives and still be able to automatically receive future upgrades from it, you must do the following:

Step 1. Open a terminal; 
Step 2. If you do not already have it, add the program repository with these commands;

rpm --import https://packages.microsoft.com/keys/microsoft.asc
https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo

Step 3. Update the package manager with the command:

dnf update

Step 4. Now use the command below to install the program;

dnf install powershell -y

How to install Microsoft PowerShell on Linux CentOS and derivatives

To install Microsoft PowerShell on Linux CentOS and its derivatives and still be able to automatically receive future upgrades from it, you must do the following:

Step 1. Open a terminal; 
Step 2. If you do not already have it, add the program repository with this command;

wget -q -O - https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo

Step 4. Now use the command below to install the program;

yun install powershell -y

Ready! Now, when you want to start the program, type powershellin a terminal (followed by the TAB key), or by clicking its icon or system application menu.

Leave a Reply

Your email address will not be published. Required fields are marked *