How do i install powershell on ubuntu?



  • Note: This is an installation for Ubuntu 18.04 and use the apt method of installation. For 18.04, it appears there is no Powershell core version at the present time. The powershell preview version is installed here.

    Microsoft documentation on installing powershell: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6

    Install the GPG keys.

    $ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   983  100   983    0     0    127      0  0:00:07  0:00:07 --:--:--   235
    OK
    

    Install the software repo.

    $ sudo curl -o /etc/apt/sources.list.d/microsoft.list https://packages.microsoft.com/config/ubuntu/18.04/prod.list
    

    Run a repository update.

    $ sudo apt update
    

    Quote from the Microsoft link at top of this article:

    When installing a PowerShell Core Preview release for Linux via a Package Repository, the package name changes from powershell to powershell-preview.

    Install the powershell software. 18.04 has the powershell-preview

    $ sudo apt-get install -y powershell-preview
    

    Start powershell. The non preview way is just pwsh

    $ pwsh-preview                      
    PowerShell 6.1.0-rc.1
    Copyright (c) Microsoft Corporation. All rights reserved.
    
    https://aka.ms/pscore6-docs
    Type 'help' to get help.
    
    PS /home/trainer> 
    

Log in to reply
 

© Lightnetics 2024