Install PowerShell Core on Ubuntu / CentOS using package management

Microsoft has release latest bits of PowerShell core and published PowerShell Core 6.0 alpha.15 to So we can use package management tools like yum or apt-get to install the latest PowerShell version on Linux distributions. It’s as simple as registering the Microsoft repository once as superuser and then just need to use either sudo apt-get install powershell or sudo yum update powershell (depending on which distribution you are using) to update it

Install PowerShell Core on Ubuntu 16.04

# Import the public repository GPG keys
curl | sudo apt-key add –
# Register the Microsoft Ubuntu repository
curl | sudo tee /etc/apt/sources.list.d/microsoft.list
# Update apt-get
sudo apt-get update
# Install PowerShell
sudo apt-get install -y powershell
# Start PowerShell

Install PowerShell Core on CentOS

# Enter superuser mode
sudo su
# Register the Microsoft RedHat repository
curl > /etc/yum.repos.d/microsoft.repo
# Exit superuser mode
# Install PowerShell
sudo yum install -y powershell
# Start PowerShell

Here’s a sample output from CentOS 7 machine:

[root@localhost userContent]# yum install -y powershell
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
jenkins | 2.9 kB 00:00
packages-microsoft-com-prod | 2.9 kB 00:00
updates | 3.4 kB 00:00
(1/3): packages-microsoft-com-prod/primary_db | 9.6 kB 00:00
(2/3): updates/7/x86_64/primary_db | 2.2 MB 00:01
(3/3): jenkins/primary_db | 19 kB 00:06
Loading mirror speeds from cached hostfile
* base:
* extras:
* updates:
Resolving Dependencies
–> Running transaction check
—> Package powershell.x86_64 0:6.0.0_alpha.15-1.el7.centos will be installed
–> Processing Dependency: uuid for package: powershell-6.0.0_alpha.15-1.el7.cen tos.x86_64
–> Running transaction check
—> Package uuid.x86_64 0:1.6.2-26.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved


Package Arch Version Repository Size

x86_64 6.0.0_alpha.15-1.el7.centos packages-microsoft-com-prod 39 M
Installing for dependencies:
uuid x86_64 1.6.2-26.el7 base 55 k

Transaction Summary

Install 1 Package (+1 Dependent package)

Total download size: 39 M
Installed size: 39 M
Downloading packages:
(1/2): uuid-1.6.2-26.el7.x86_64.rpm | 55 kB 00:00
warning: /var/cache/yum/x86_64/7/packages-microsoft-com-prod/packages/powershell -6.0.0_alpha.15-1.el7.centos.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID be1229cf: NOKEY
Public key for powershell-6.0.0_alpha.15-1.el7.centos.x86_64.rpm is not installe d

(2/2): powershell-6.0.0_alpha.15-1.el7.centos.x86_64.rpm | 39 MB 00:05

Total 6.9 MB/s | 39 MB 00:05
Retrieving key from
Importing GPG key 0xBE1229CF:
Userid : “Microsoft (Release signing) ”
Fingerprint: bc52 8686 b50d 79e3 39d3 721c eb3e 94ad be12 29cf
From :
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : uuid-1.6.2-26.el7.x86_64 1/2
Installing : powershell-6.0.0_alpha.15-1.el7.centos.x86_64 2/2
Verifying : powershell-6.0.0_alpha.15-1.el7.centos.x86_64 1/2
Verifying : uuid-1.6.2-26.el7.x86_64 2/2

powershell.x86_64 0:6.0.0_alpha.15-1.el7.centos

Dependency Installed:
uuid.x86_64 0:1.6.2-26.el7

Once you done this, you can use built in $PSVersionTable to confirm that its working properly:

Checking for PowerShell core version on CentOS
Checking for PowerShell core version on CentOS

Or you can also use which command in linux to check if its installed. To get back to bash/login shell, type exit from PowerShell prompt.

Also, even if this is an alpha release, tab completion for cmdlet works. Intellisense works in more or less the same way as linux distributions. For example, if you type Get-ChildItem – and then press tab for getting parameters, nothing comes out. But if you press tab twice, it will list all parameters. Again, if you type the partial name of parameter, press tab twice to list it:

Tab completion for parameters in PowerShell Core
Tab completion for parameters in PowerShell Core

2 thoughts on “Install PowerShell Core on Ubuntu / CentOS using package management

  1. […] It has been a long time since the PowerShell integrated scripting environment (ISE) shipped with Windows PowerShell 2.0 in 2009. Since then .NET has become open source and cross-platform in form of .NET Core. Since PowerShell is built on top of .NET, it was an important pre-requisite before making PowerShell cross platform. Also, PowerShell has become cross-platform as of today. It is also open-source like .NET core. You can find the same at GitHub as well. In fact, we did discuss the open-source PowerShell namely 6.0 installation in few of the earlier posts as well.  […]


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s