How to install PowerShell Core on Linux Mint 18

Beside my Lenovo X250, which is my primary working machine, I’m using a HP ProBook 6450b. This was my primary working machine from 2010 until 2013. With a 128 GB SSD, 8 GB RAM and the Intel i5 M 450 CPU, it is still a pretty usable machine. I used it mainly during projects, when I needed a second laptop (or the PC Express card with the serial port…). It was running Windows 10, until I decided to try Linux MInt. I used Linux as my primary desktop OS more than a decade ago. It was quite productive, but especially with laptops, there were many things that does not worked out of the box.

Because I use PowerShell quite often, and PowerShell is available for Windows, MacOS and Linux, the installation of PowerShell on this Linux laptop is a must.

How to install PowerShell?

Linux Mint is a based on Ubuntu, and I’m currently using Linux Mint 18.2. Microsoft offers different pre-compiled packages on the PowerShell GitHub repo. For Linux Mint 18, you have to download the Ubuntu 16.04 package. For Linux Mint 17, you will need the 14.04 package. Because you need the shell to install the packages, you can download the deb package from the shell as well. I used wget to download the deb package.

patrick@nb-patrick ~/Downloads
 % wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-beta.8/powershell\_6.0.0-beta.8-1.ubuntu.16.04\_amd64.deb

The next step is to install the deb package, and to fix broken dependencies. Make sure that you run dpkg  with sudo .

patrick@nb-patrick ~/Downloads
 % sudo dpkg -i powershell\_6.0.0-beta.8-1.ubuntu.16.04\_amd64.deb 
Selecting previously unselected package powershell.
(Reading database ... 235671 files and directories currently installed.)
Preparing to unpack powershell\_6.0.0-beta.8-1.ubuntu.16.04\_amd64.deb ...
Unpacking powershell (6.0.0-beta.8-1.ubuntu.16.04) ...
dpkg: dependency problems prevent configuration of powershell:
 powershell depends on liblttng-ust0; however:
  Package liblttng-ust0 is not installed.

dpkg: error processing package powershell (--install):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
 powershell

Looks like it failed, because of broken dependencies. But this can be easily fixed. To fix the broken dependencies, run apt-get -f install . Make sure that you run it with sudo !

patrick@nb-patrick ~/Downloads
 % sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  liblttng-ust-ctl2 liblttng-ust0 liburcu4
The following NEW packages will be installed:
  liblttng-ust-ctl2 liblttng-ust0 liburcu4
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 247 kB of archives.
After this operation, 1.127 kB of additional disk space will be used.
Do you want to continue? \[Y/n\] y
Get:1 http://mirror.netcologne.de/ubuntu xenial/universe amd64 liburcu4 amd64 0.9.1-3 \[47,3 kB\]
Get:2 http://mirror.netcologne.de/ubuntu xenial/universe amd64 liblttng-ust-ctl2 amd64 2.7.1-1 \[72,2 kB\]
Get:3 http://mirror.netcologne.de/ubuntu xenial/universe amd64 liblttng-ust0 amd64 2.7.1-1 \[127 kB\]
Fetched 247 kB in 0s (841 kB/s)        
Selecting previously unselected package liburcu4:amd64.
(Reading database ... 236372 files and directories currently installed.)
Preparing to unpack .../liburcu4\_0.9.1-3\_amd64.deb ...
Unpacking liburcu4:amd64 (0.9.1-3) ...
Selecting previously unselected package liblttng-ust-ctl2:amd64.
Preparing to unpack .../liblttng-ust-ctl2\_2.7.1-1\_amd64.deb ...
Unpacking liblttng-ust-ctl2:amd64 (2.7.1-1) ...
Selecting previously unselected package liblttng-ust0:amd64.
Preparing to unpack .../liblttng-ust0\_2.7.1-1\_amd64.deb ...
Unpacking liblttng-ust0:amd64 (2.7.1-1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Setting up liburcu4:amd64 (0.9.1-3) ...
Setting up liblttng-ust-ctl2:amd64 (2.7.1-1) ...
Setting up liblttng-ust0:amd64 (2.7.1-1) ...
Setting up powershell (6.0.0-beta.8-1.ubuntu.16.04) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...

That’s it! PowerShell is now installed.

patrick@nb-patrick ~/Downloads
 % powershell
PowerShell v6.0.0-beta.8
Copyright (C) Microsoft Corporation. All rights reserved.

PS /home/patrick/Downloads>  Get-ChildItem /home/patrick                                                                                                                                              

    Directory: /home/patrick

Mode                LastWriteTime         Length Name                                                                                                                                                
---- ------------- ------ ---- 
d----- 10/10/17  10:26 PM                Desktop                                                                                                                                             
d----- 10/14/17   8:45 AM                Documents                                                                                                                                           
d----- 10/14/17   8:41 AM                Downloads                                                                                                                                           
d----- 10/10/17  10:26 PM                Music                                                                                                                                               
d----- 10/14/17   8:37 AM                Pictures                                                                                                                                            
d----- 10/10/17  10:26 PM                Public                                                                                                                                              
d----- 10/10/17  10:26 PM                Templates                                                                                                                                           
d----- 10/10/17  10:26 PM                Videos                                                                                                                                              

PS /home/patrick/Downloads> exit                                                                                                                                                                      
patrick@nb-patrick ~/Downloads
 %

Yep, looks like a PowerShell prompt…on Linux. Thank you, Microsoft! :)