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

Using the binary archives

If your package manager does not have PowerShell, use the binary archives:

  1. Install the dependencies based on your operating system. Here are the dependencies required in the case of Ubuntu 16.04, Ubuntu 18.04, and CentOS:
  1. Use curl to get the archived file:
$ curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v6.1.0/powershell-6.1.0-linux-x64.tar.gz
  1. Create the directory where PowerShell will be installed:
$ sudo mkdir -p /opt/microsoft/powershell/6.1.0
  1. Unpack the binaries into the directory you just created:
$ sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/6.1.0
  1. Add execute permissions to the file:
$ sudo chmod +x /opt/microsoft/powershell/6.1.0/pwsh
  1. Create a symbolic link to point to pwsh:
$ sudo ln -s /opt/microsoft/powershell/6.1.0/pwsh /usr/bin/pwsh