在CentOS上安装PowerShell

微软刚刚开源了PowerShell,目前在Linux和MacOS上都能安装。具体的链接如下:

https://github.com/PowerShell/PowerShell

本文将介绍如何在CentOS 7.2下安装PowerShell。

首先在CentOS下下载PowerShell的安装包:

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
或者:
wget https://hweast.blob.core.chinacloudapi.cn/soft/powershell-6.0.0_alpha.9-1.el7.centos.x86_64.rpm

 

安装时报错:

rpm -ivh powershell-6.0.0_alpha.9-1.el7.centos.x86_64.rpm
warning: powershell-6.0.0_alpha.9-1.el7.centos.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID be1229cf: NOKEY
error: 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

需要通过yum安装两个依赖包:

yum install -y libunwind libicu

安装完成后,再次运行rpm安装成功。

rpm -ivh powershell-6.0.0_alpha.9-1.el7.centos.x86_64.rpm
warning: powershell-6.0.0_alpha.9-1.el7.centos.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID be1229cf: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:powershell-6.0.0_alpha.9-1 ################################# [100%]

成功后,可以运行powershell启动powershell环境:

[root@hwslbvm02 ~]# powershell
PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
 
PS /root> get-module
 
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script 1.2 PSReadLine {Get-PSReadlineKeyHandler, Get-PSReadlineOption, Remove-PSReadlineKeyHandler, Set-PSReadlineKey...
 
PS /root> Get-PSRepository
 
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2/

 

转载于:https://www.cnblogs.com/hengwei/p/5788677.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值