Microsoft has just open source PowerShell, which is now installed on both Linux and MacOS. The specific links are as follows:
Https://github.com/PowerShell/PowerShell
This article describes how to install PowerShell under CentOS 7.2.
First download the PowerShell installation package under CentOS:
wget https://github.com/powershell/powershell/releases/download/v6.0.0-alpha.9/ powershell-6.0.0_alpha.9-1.el7.centos.x86_64.rpm or:wget https:// hweast.blob.core.chinacloudapi.cn/soft/powershell-6.0.0_alpha.9-1.el7.centos.x86_64.rpm
Install times wrong:
RPM-IVH powershell-6.0. 0_alpha. 9-1. El7.centos.x86_64.rpmwarning:powershell-6.0. 0_alpha. 9-1. El7.centos.x86_64.rpm:Header V3 rsa/SHA256 Signature, key ID be1229cf:NOKEYerror:Failed Dependencies:libunwind is needed by PowerShell-6.0. 0_alpha. 9-1. x86_64 Libicu is needed by PowerShell-6.0. 0_alpha. 9-1. x86_64
You need to install two dependent packages via Yum:
Yum Install -y libunwind Libicu
After the installation is complete, run the RPM installation again successfully.
RPM-IVH powershell-6.0. 0_alpha. 9-1. El7.centos.x86_64.rpmwarning:powershell-6.0. 0_alpha. 9-1. El7.centos.x86_64.rpm:Header V3 rsa/SHA256 Signature, key ID be1229cf:nokeypreparing ... # # # ############################## [%/ Installing ... 1:p owershell-6.0. 0_alpha. 9-1 ################################# [%]
After success, you can run PowerShell to start the PowerShell environment:
[[Email protected] ~]# powershellpowershellcopyright (C) .Microsoft Corporation. All rights reserved. PS/root> get-module Moduletype Version Name exportedcommands---------- ------- ---- ----------------Manifest3.1.0.0Microsoft.PowerShell.Utility {add-member, Add-type, clear-variable, compare-Object ...} Script1.2Psreadline {get-psreadlinekeyhandler, get-psreadlineoption, Remove-psreadlinekeyhandler, Set-Psreadlinekey ... PS/root> get-psrepository Name installationpolicy sourcelocation---- ------------------ --------------Psgallery untrusted https://www.powershellgallery.com/api/v2/
Installing PowerShell on CentOS