How to install PowerShell on Ubuntu Linux

How to install PowerShell on Ubuntu Linux

Any admin coming to Linux from Windows might want to add PowerShell to the open source operating system. Jack Wallen shows you how.

Most every Windows admin is very familiar with PowerShell. Everyone else might not know about this tool. If you’re of the latter category, know that PowerShell is a task-based command-line shell and scripting language that was built with .NET. With PowerShell, you can easily automate tasks for the management of operating systems and much more. 

At one point, PowerShell was only available for MS Windows. Now, however, this admin tool can be installed and used on Linux. Let me show you how to install PowerShell on Ubuntu Server 18.04. 

SEE: Choosing your Windows 7 exit strategy: Four options (TechRepublic Premium)

The first thing you must do is download and install the necessary repository GPG keys with the commands:

wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb

Next, update apt with the command:

sudo apt-get update

You must also enable the “universe” repository with the command:

sudo add-apt-repository universe

Finally, install PowerShell with the command:

sudo apt-get install powershell -y

For those using Linux distributions that support snap, you can install PowerShell with a single command:

sudo snap install powershell --classic

Once PowerShell is installed, you can start it with the command:

pwsh

That’s all there is to it. You now have the ability to work with what was once a Windows-only scripting tool for the automation of many tasks. For those that come from a Windows environment, enjoy that added familiarity. Everyone else, time to learn a new tool.

Also see

linuxadminhero.jpg

Source of Article