How to Install PowerShell on Oracle Linux, RHEL and CentOS
Windows PowerShell is getting more common now-a-days with Oracle PeopleSoft DPKs needing you to run PowerShell scripts. In fact, it is not just limited to PeopleSoft – it is pretty common with Administrators, who manage Linux, Windows and networked clients.
Way back in 2001, ex-Microsoft CEO Steve Ballmer branded Linux “a cancer” during the height of Microsoft’s domination of desktop computing. Fast forward to 2016 with CEO Satya Nadella at helm, Microsoft declared its love for everything open source and Linux: Microsoft ♥ Linux. Microsoft came out with the open-sourced and cross-platform PowerShell version, which offered Linux and macOS installers.
Linux PowerShell brought in lots of new features and although it is essentially the same program, there are key differences such as the ability to run standard Bash commands in Linux PoweShell. Microsoft is now the top organization with the most open source contributors on Github.
How to Install Powershell in Linux
- Head over to Get PowerShell section of PowerShell page on GitHub.
- It has link to download and install PoweShell package for a lot of platforms like Ubuntu, CentOS, macOS, Windows 10 etc. Download the one appropriate for you. For example, in my case, I’m using Oracle Linux and I downloaded the CentOS package, which also works for RHEL 7 and Oracle Linux CentOS. Package is powershell-6.0.0_alpha.18-1.el7.centos.x86_64.rpm.
- Easiest way to install PowerShell is to do installation via package repository since PowerShell Core for Linux is published to official Microsoft repositories.
- Run the command:
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
- Run the below command to install PowerShell:
sudo yum install -y powershell
- Run the below command to run PowerShell: