Microsoft PowerShell Core for Linux is a task-based command-line shell and scripting language built on .NET. It’s a core feature of Windows systems and Microsoft has also made it available to Linux systems including Ubuntu.
This brief tutorial shows students and new users how to install and enable Microsoft PowerShell Core for Linux on Ubuntu 16.04 | 18.04.
PowerShell can be used as an automation and configuration management platform. It consists of a cross-platform (Windows, Linux, and macOS) command-line shell and associated scripting language.
For more about PowerShell Core on Linux, please go to its homepageTo install PowerShell Core on Ubuntu, follow the steps below:
There are many ways to install PowerShell Core on Ubuntu. The two methods below are the easiest ways to install the program on Ubuntu.
Method #1: Installing PowerShell Core via Repository
The first method of install PowerShell core on Ubuntu is via its repository. To do that, you’ll have to download the repository file, install it, update Ubuntu and then install the core packages.
To get the repository installed, run the commands below to download and install the repository key file.
For Ubuntu 16.04:
cd /tmp wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb
For Ubuntu 18.04:
cd /tmp wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb
After downloading the correct key file and installing it for your system, run the commands below to refresh Ubuntu package lists and instal PowerShell
sudo apt update sudo apt install powershell #Start PowerShell pwsh
Method #2: Installing PowerShell via Snap
Another way to get PowerShell installed is via Snap package management… Snaps are containerised software packages that are simple to create and install…. They are applications packaged with all their dependencies to run on all popular Linux distributions from a single build which allow them to update automatically and roll back gracefully….
This might be the easiest way to get PowerShell on Linux systems, including Ubuntu… To install, run the commands below install Snap…
sudo apt update sudo apt install snapd
Then run the commands below to get PowerShell installed via Snap.
sudo snap install powershell --classic
After installing, you can go to the Activities Overview board and search for PowerShell to launch it. When it opens you should see a message similar to the one below:
PowerShell 6.1.1 Copyright (c) Microsoft Corporation. All rights reserved. https://aka.ms/pscore6-docs Type 'help' to get help. PS /home/richard>
You may also like the post below: