How to install PowerShell on Ubuntu Linux
Updated: May 27, 2020
Any administrator who comes to Linux from Windows may want to add PowerShell to the open source operating system.
Most Windows administrators are very familiar with PowerShell. No one else knows about this tool. If you fall into the latter category, be aware that PowerShell is a command line and task-based scripting language built with .NET. With PowerShell, you can easily automate tasks to manage operating systems and much more.
At one point, PowerShell was only available for MS Windows. Now, however, this administration tool can be installed and used on Linux. Let me show you how to install PowerShell on the Ubuntu 18.04 server.
EE: Choosing an exit strategy for Windows 7: four options (TechRepublic Premium)
The first thing to do is to download and install the GPG keys from the warehouse with the commands:
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb
Then update apt with the command:
sudo apt-get update
You must also activate 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 the 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:
And that's all there is to it. We now have the option of working with what was previously a Windows scripting tool just to automate many tasks. For those who come from the Windows environment, we always wish you the best and learn new tools.