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
  • 193,181
  • 53
  • 473
  • 722

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
  • 278
  • 3
  • 10
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
  • 293,910
  • 41
  • 570
  • 710
  • 1
    They added "man" pages for commands so you will get those when you install powershell. On their site they point to MSDN (the nerver ;-) ) https://msdn.microsoft.com/en-us/powershell/scripting/core-powershell/console/powershell.exe-command-line-help – Rinzwind Feb 02 '17 at 08:00
  • 1
    Here are the english docs: https://github.com/PowerShell/PowerShell-Docs – Rinzwind Feb 02 '17 at 08:02
  • 1
    These direct links now point to outdated downloads. Please follow the link to GitHub or install the repo and use the package manager – uSlackr Jun 19 '18 at 16:22
4

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
  • 110,292
  • 102
  • 269
  • 299
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

  • 1
    `apt install ./foo.deb` will resolve dependencies, so you don't need a `apt-get install -f` after it. – muru Feb 02 '17 at 12:57
  • 1
    Why bother updating this when MS has published a repo? https://askubuntu.com/a/925458/158442 – muru Jul 27 '17 at 02:56