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.

0
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
6
  • 1
    Here's the current doc link: docs.microsoft.com/en-us/powershell/scripting/setup/…
    – uSlackr
    Sep 18 '18 at 2:00
  • 1
    Needed apt-get install apt-transport-https on 16.04 (docker).
    – arun
    Apr 15 '20 at 22:40
  • @arun Did you need that as a prerequisite to install Powershell or to enable a particular feature/cmdlet?
    – uSlackr
    Apr 16 '20 at 14:28
  • to install Powershell
    – arun
    Apr 16 '20 at 15:09
  • I'll take a look and update Thanks
    – uSlackr
    Apr 17 '20 at 17:02
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
3
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
1
  • This works on Ubuntu 18.04.1 LTS
    – Underverse
    Feb 10 '19 at 7:41
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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.