PowerShell Core for Linux Administrators Cookbook
上QQ阅读APP看书,第一时间看更新

Installing from the repository

Ubuntu 16.04 and Ubuntu 18.04 have the stable release of PowerShell available. Follow these steps if you wish to install PowerShell on Ubuntu:

  1. Download the GPG keys for the Microsoft repository:
$ # On Ubuntu 16.04
$ wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb

$ # On Ubuntu 18.04
$ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
  1. Register the GPG keys:
$ sudo dpkg -i packages-microsoft-prod.deb
  1. Update the package list using the following command:
$ sudo apt update
  1. Install PowerShell using apt-get:
$ # To install PowerShell (stable)
$ sudo apt install -y powershell

$ # To install PowerShell (preview)
$ sudo apt install -y powershell-preview

  1. Run PowerShell using the following command:
$ # If you installed PowerShell (stable)
$ pwsh

$ # If you installed PowerShell (preview)
$ pwsh-preview