如何安装PowerShell?
不久前,我在微软的网站上看到有关PowerShell可用于Ubuntu的内容。
我将如何安装PowerShell? 我非常感谢Xenial & Trusty的指导。
无论是编译源代码还是依赖于包管理器,任何安装方法都可以。 源编译方法应包含初级级别的详细信息。
截至2017年2月,Microsoft已通过公共存储库提供这些服务,这可以带来所有存储库的优点。 细节在这里。
以下是16.04安装的说明
# 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 the list of products sudo apt-get update # Install PowerShell sudo apt-get install -y powershell # Start PowerShell (MS renamed main executable at launch to be more Linux-like) pwsh
对于debian安装文件(’.deb’)和其他下载,请参阅GitHub上的PowerShell版本 。
使用SHA256哈希的直接下载链接:
-
14.04: powershell_6.0.0-alpha.16-1ubuntu1.14.04.1_amd64.deb
FB0002D6D57D900D0BA16C13C4EB0B84CA9D1AEA5EAF4DDBC0F7E8F3D582A2DF
-
16.04: powershell_6.0.0-alpha.16-1ubuntu1.16.04.1_amd64.deb
96A647EFA64C704958CEAFA89F319950A3B729C161CB77C286561AF3CD3BFC1E
下载DEB,validation校验和,然后让Ubuntu软件中心负责安装它。 有关如何validation下载的信息,请参阅help.ubuntu.com 。 基本上,输入以下命令:
sha256sum powershell_*.deb
PowerShell
版本: v6.0.0-beta.4
Ubuntu 14.04 LTS(Trusty Tahr)
[方法#1] ~APT
wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-beta.4/powershell_6.0.0-beta.4-1ubuntu1.14.04.1_amd64.deb sudo apt install ./powershell_*.deb
[方法#2] ~dpkg
wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-beta.4/powershell_6.0.0-beta.4-1ubuntu1.14.04.1_amd64.deb dpkg -i powershell_*.deb apt-get install -f
Ubuntu 16.04 LTS(Xenial Xerus)
[方法#1] ~APT
wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-beta.4/powershell_6.0.0-beta.4-1ubuntu1.16.04.1_amd64.deb sudo apt install ./powershell_*.deb
[方法#2] ~dpkg
wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-beta.4/powershell_6.0.0-beta.4-1ubuntu1.16.04.1_amd64.deb dpkg -i powershell_*.deb apt-get install -f
- PowerShell – 发布(GitHub)
- PowerShell – 文档
- PowerShell – 初学者指南
- PowerShell – 命令行调试
Ubuntu 14.04及更高版本
PowerShell可以作为快照包安装在所有当前支持的Ubuntu版本中。 要安装PowerShell管理包,请打开终端并键入:
sudo snap install powershell --classic