How to install Powershell for Linux in Ubuntu 16.04.

Installing Powershell for Linux in Ubuntu 16.04 is very easy. I had problems with the packages, but I sorted it out very quickly.

Firstly, download the Powershell Debian package.

https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.9/powershell_6.0.0-alpha.9-1ubuntu1.14.04.1_amd64.deb.

Then the required libicu package.

http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu52_52.1-3ubuntu0.4_amd64.deb.

Then install the libicu package.

jason$ sudo dpkg -i libicu52_52.1-3ubuntu0.4_amd64.deb 
Selecting previously unselected package libicu52:amd64.
(Reading database ... 490392 files and directories currently installed.)
Preparing to unpack libicu52_52.1-3ubuntu0.4_amd64.deb ...
Unpacking libicu52:amd64 (52.1-3ubuntu0.4) ...
Setting up libicu52:amd64 (52.1-3ubuntu0.4) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...

Then we can install Powershell.

jason$ sudo dpkg -i powershell_6.0.0-alpha.9-1ubuntu1.14.04.1_amd64.deb 
(Reading database ... 490413 files and directories currently installed.)
Preparing to unpack powershell_6.0.0-alpha.9-1ubuntu1.14.04.1_amd64.deb ...
Unpacking powershell (6.0.0-alpha.9-1) over (6.0.0-alpha.9-1) ...
Setting up powershell (6.0.0-alpha.9-1) ...
Processing triggers for man-db (2.7.5-1) ...

Then, if the installation was successful, run the powershell command to open Powershell.

jason$ powershell
PowerShell 
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
 
PS /home/jason/Downloads>

And try a Powershell cmdlet.

jason$ powershell
PowerShell 
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
 
PS /home/jason/Downloads> get-host                                                                                                                                  
 
 
Name             : ConsoleHost
Version          : 6.0.0
InstanceId       : a590917f-08b8-4473-9f90-8504c576a370
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-AU
CurrentUICulture : en-AU
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

And list contents of a directory easily.

Listing a directory in Powershell.
Listing a directory in Powershell.

This is a very cool development, the ability to install Powershell 6.0 on Linux and use it in a terminal. This could be very useful when it is able to connect to a remote Windows Server machine and use remote Powershell to administer the remote machine. Give this a try yourself and see how you go.

Powershell releases: https://github.com/PowerShell/PowerShell/releases/.

Ubuntu libicu package page: http://packages.ubuntu.com/trusty/amd64/libicu52/download.

Powershell on Linux github: https://github.com/PowerShell/PowerShell.

No comments have been made. Use this form to start the conversation :)

Leave a Reply