This is a quick and easy post to get PowerShell Core up and running on CentOS 7 Linux. We assume your CentOS 7 machine is online and available.

Update CentOS

Always update before trying to install PowerShell.

sudo yum update -y

Add the Microsoft repo

curl | sudo tee /etc/yum.repos.d/microsoft.repo

Install PowerShell

sudo yum install -y powershell

Launch PowerShell


Run a command

[mike@centos ~]$ pwsh
PowerShell v6.1.0-preview.2
Copyright (c) Microsoft Corporation. All rights reserved.
Type 'help' to get help.
PS /home/mike>

Show Version

PS /home/mike> $PSVersionTable                                                      

Name                           Value
----                           -----
PSVersion                      6.1.0-preview.2
PSEdition                      Core
GitCommitId                    v6.1.0-preview.2
OS                             Linux 3.10.0-862.3.3.el7.x86_64 #1 SMP Fri Jun 15 04:15:27 UTC 2018
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
WSManStackVersion              3.0

Updating PowerShell

In the future, you may need to update.

sudo yum update powershell