Microsoft has release latest bits of PowerShell core and published PowerShell Core 6.0 alpha.15 to https://packages.microsoft.com. 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import the public repository GPG keys | |
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add – | |
# Register the Microsoft Ubuntu repository | |
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | 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 | |
powershell |
Install PowerShell Core on CentOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enter superuser mode | |
sudo su | |
# Register the Microsoft RedHat repository | |
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/microsoft.repo | |
# Exit superuser mode | |
exit | |
# Install PowerShell | |
sudo yum install -y powershell | |
# Start PowerShell | |
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: mirror.fibergrid.in
* extras: mirror.fibergrid.in
* updates: mirror.fibergrid.in
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
Installing:
powershell
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 https://packages.microsoft.com/keys/microsoft.asc
Importing GPG key 0xBE1229CF:
Userid : “Microsoft (Release signing) ”
Fingerprint: bc52 8686 b50d 79e3 39d3 721c eb3e 94ad be12 29cf
From : https://packages.microsoft.com/keys/microsoft.asc
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
Installed:
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:

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:

[…] Now let’s save and build the job. Note that we have Jenkins installed on a Windows machine for this post’s purposes. PowerShell for Linux versions is still in alpha stage and if you want to install PowerShell on a linux distro, check this post. […]
LikeLike
[…] 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. […]
LikeLike