This article explains how to install PowerShell Core for Linux on Ubuntu Linux.
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.
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 homepage
There are many ways to install PowerShell Core on Ubuntu. The two methods below are the easiest ways to install the program on Ubuntu.
Install PowerShell Core via Repository
The first method of installing PowerShell core on Ubuntu is via its repository. Next, you’ll have to download the repository file, install it, update Ubuntu, and install the core packages.
Run the commands below to download and install the repository key file to get the repository installed.
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 install PowerShell
sudo apt update sudo apt install powershell #Start PowerShell pwsh
That’s it!
Install PowerShell via Snap
Another way to get PowerShell installed is via Snap package management. Snaps are containerized 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, allowing 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>
Enjoy!
You may also like the post below:
Leave a Reply