In this guide, I’ll walk you through the steps to install PowerShell Core on Ubuntu 18.04 LTS. PowerShell is a command-line shell and scripting language tool built on the .NET Framework. PowerShell allows System Administrators to perform task automation and configuration management.

PowerShell Core can be installed on Ubuntu 18.04 by using Microsoft Debian repository. Add the repository to your Ubuntu 18.04 system using the command below.

sudo update update && sudo apt -y install wget
wget -q
sudo dpkg -i packages-microsoft-prod.deb

A successful installation should have an output like below:

Selecting previously unselected package packages-microsoft-prod.
(Reading database ... 105206 files and directories currently installed.)
Preparing to unpack packages-microsoft-prod.deb ...
Unpacking packages-microsoft-prod (1.0-ubuntu18.04.1) ...
Setting up packages-microsoft-prod (1.0-ubuntu18.04.1) ...

Finally update Package index list and install PowerShell:

sudo apt update
sudo apt -y install powershell

To start PowerShell, use the command:

# pwsh
PowerShell 6.1.1
Type 'help' to get help.

PS /home/vagrant>

Test command execution:

PS /home/vagrant> Get-ChildItem / 

    Directory: /

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         10/29/18  11:19 PM                bin
d-----         10/29/18  11:27 PM                boot
d-----         12/18/18   1:25 PM                dev
d-----         12/18/18   1:39 PM                etc
d-----         10/29/18  11:17 PM                home
d-----         10/29/18  11:21 PM                lib
d-----         10/29/18  11:12 PM                lib64
d-----         10/29/18  11:12 PM                lost+found
d-----         10/29/18  11:12 PM                media
d-----          7/24/18   7:51 PM                mnt
d-----         12/18/18   1:39 PM                opt
d-r---         12/18/18   1:25 PM                proc
d-----         12/18/18   1:40 PM                root
d-----         12/18/18   1:40 PM                run
d-----         10/29/18  11:21 PM                sbin
d-----         10/29/18  11:18 PM                snap
d-----          7/24/18   7:51 PM                srv
d-r---         12/18/18   1:25 PM                sys
d-----         12/18/18   1:40 PM                tmp
d-----         10/29/18  11:12 PM                usr
d-----         10/29/18  11:15 PM                var
-----l         10/29/18  11:21 PM             33 initrd.img
-----l         10/29/18  11:13 PM             33 initrd.img.old
-----l         10/29/18  11:21 PM             30 vmlinuz
-----l         10/29/18  11:13 PM             30 vmlinuz.old

PS /home/vagrant> dir

    Directory: /home/vagrant

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
--r---           5/8/18   3:11 PM           2644 packages-microsoft-prod.deb

PS /home/vagrant>

That’s all. Read more about PowerShell  Administration.

Also check:

How to install Microsoft SQL Server 2019 on CentOS 7 / Fedora

How to install MS SQL on Ubuntu 18.04 LTS

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here