19

Not long ago I read something on Microsoft's website about PowerShell being available for Ubuntu.

How would I go about the install of PowerShell? I'd appreciate guidance for both Xenial & Trusty.

Any installation method is fine, whether compiling source or relying on a package-manager. Source-compiling methods should contain beginner-level detail.

muru
  • 207,228

4 Answers4

14

As of February 2017, Microsoft has made these available though a public repository which brings all the repository goodness. Details here.

Here are the instructions to install the latest version of PowerShell on 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
uSlackr
  • 280
10

For debian install files ('.deb') and other downloads, see PowerShell releases on GitHub.

Direct download links, with SHA256 hashes:


Download the DEB, verify the checksum, and then let Ubuntu Software Center take care of installing it. See help.ubuntu.com on how to verify the download. Basically, enter the following command:

sha256sum powershell_*.deb
Rinzwind
  • 309,379
5

Ubuntu 14.04 and later

PowerShell can be installed as a snap package in all currently supported versions of Ubuntu. To install the PowerShell snap package open the terminal and type:

sudo snap install powershell --classic

To start PowerShell from the terminal type:

snap run powershell
karel
  • 122,292
  • 133
  • 301
  • 332
2

PowerShell Release: v6.0.0-beta.4


Ubuntu 14.04 LTS (Trusty Tahr)

[Method #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

[Method #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)

[Method #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

[Method #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