How to Install Microsoft PowerShell 6.1.1 on Ubuntu 18.04 LTS

What is PowerShell?

Microsoft PowerShell is a shell framework used to execute commands, but primarily it is developed to perform administrative tasks such as

  • Automation of repetitive jobs
  • Configuration management

PowerShell is an open-source and cross-platform project; it can be installed on Windows, macOS, and Linux. It includes an interactive command-line shell and a scripting environment.

How Ubuntu 18.04 made installation of PowerShell easier?

Ubuntu 18.04 has made installation of apps much easier via snap packages. For those who’re new to the phrase “snap package”, Microsoft has recently introduced a snap package for PowerShell. This major advancement allows Linux users/admins to install and run the latest version of PowerShell in fewer steps explained in this article.

Prerequisites to install PowerShell in Ubuntu 18.04

The following minimum requirements must exist before installing PowerShell 6.1.1 in Ubuntu 18.04

  • 2 GHz dual-core processor or better
  • 2 GB system memory
  • 25 GB of free hard drive space
  • Internet access
  • Ubuntu 18.04 LTS (long term support)

Steps to Install PowerShell 6.1.1 via Snap in Ubuntu 18.04 LTS

There are two ways to install PowerShell in Ubuntu i.e. via terminal or via Ubuntu Software Application.

via Terminal

Step 1: Open A Terminal Console

The easiest way to open a Terminal is to use the key combination Ctrl+Alt+T at the same time.

Open Ubuntu Console

Step 2: Snap Command to Install PowerShell

Enter snap package command i.e. “snap install powershell --classic” in the Terminal console to initiate installation of PowerShell in Ubuntu.

The prompt of Authentication Required on your screen is exclusively for security purposes. Before initiating any installation in Ubuntu 18.04, by default, the system requires to authenticate the account initiating this installation.

To proceed, the user must enter credentials of the account they’re currently logged in with.

Authenticate as admin

Step 3: Successful Installation of PowerShell

As soon as the system authenticates the user, Installation of PowerShell will begin in Ubuntu. (Usually, this installation takes 1-2 minutes)

The user can continuously see the status of installation in the terminal console.

At the end of the installation, the status of PowerShell 6.1.1 frommicrosoft-powershell’ installed is shown as it can be seen in the screenshot below.

Install PowerShell snap

Step 4: Launch PowerShell via Terminal

After successful installation, it’s time to launch PowerShell which is a one-step process.

Enter Linux command “powershell” in the terminal console and it will take you to PowerShell terminal in an instant.

powershell

You must be in the PowerShell prompt by now and ready to experience the world of automation and scripting.

Microsoft PowerShell on Ubuntu

via Ubuntu Software

Step 1: Open Ubuntu Software

Ubuntu has facilitated its users with a desktop application of Ubuntu Software. It contains the list of all software and updates available.

  • Open the Ubuntu Software Manager from the Ubuntu desktop.

Step 2: Search for PowerShell in Ubuntu Software

  • Under the list of All software, search for “powershell” through the search bar.
  • Search Results must include “powershell” software as marked in the screenshot below.
  • Click on “powershell” software and proceed to Step 3.

Step 3: Installing PowerShell via Ubuntu Software

  • The user must be able to see the details of “powershell” software and the Install button

(for reference, it’s marked in below image)

  • Click on the Install button, it will initiate installation.

(Installation via Ubuntu Software takes 1-2 minutes)

  • The User can see installation status continuously on the screen and will be notified once installation completes.

Install PowerShell

Installing PowerShell

Step 4: Launch PowerShell via Ubuntu Software

After successful installation of PowerShell 6.1.1 via Ubuntu Software, the user can now launch PowerShell terminal and use it for multiple purposes and features which Microsoft PowerShell has to offer for its Linux users.

  • Click on “Launch” button (for reference, marked in below image). It will take you to PowerShell terminal successfully.

Launch PowerShell

Test PowerShell Terminal via Commands

To test if PowerShell is working accurately, the user can enter few Linux commands like:

“$PSVersionTable” to find Version of PowerShell installed (for reference, the result of this command attached in the screenshot below)

PowerShell gives its user endless power over the system and its directories. After following the above-mentioned steps in this article, now you must be all set to experience the exciting and productive world of automation and scripting through Microsoft PowerShell.