Introduction

In this article we get you up and running with PowerShell 6.0.1 Core preview 3, on the latest Ubuntu 18.04. This works for both Desktop or Server versions of the latest Ubuntu.

Installation Steps

Perform the following from the terminal or an SSH session to the host:

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

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

sudo apt-get update

sudo apt-get install -y powershell-preview

If you do not have curl you can install it with sudo apt -y install curl and then try the above again.

Launch PowerShell preview

Using pwsh-preview is the new way to launch preview versions of PowerShell Core. Previously it was simply pwsh, but that is now reserved for stable releases.

pwsh-preview

Show Version

$PSVersionTable

Example Output
Ubuntu-18.04-Desktop-Launching-PowerShell

Exiting PowerShell

Type exit to leave your PowerShell session. This returns you to the terminal prompt. Try launching more PowerShell prompts from within a PowerShell prompt so you can get familiar with the look of the terminal compared to PowerShell.

Update-Help

You can do this anytime to update the PowerShell help.

Update-Help

PowerShell $Profile

Optionally, create a PowerShell $PROFILE. This allows us to customize how PowerShell starts up (i.e. modules to load, directory to start in, etc.).

Configure PowerShell

Here we add a line to our $PROFILE that stops the beeping sound that PowerShell makes.

Add-Content -Value "Set-PSReadlineOption -BellStyle None" -Path $PROFILE

Reload your PowerShell $PROFILE, or exit

There is a shortcut to reload the PowerShell $PROFILE:

& $PROFILE

View $PROFILE Contents

cat $PROFILE

Install PowerCLI (optional)

If you are a VMware vSphere user, you may want the VMware.PowerCLI module. This works perfectly.

Install-Module VMware.PowerCLI -Scope CurrentUser

Summary

In this quick article we installed and launched the latest PowerShell 6.0.1 Core preview 3 on Ubuntu 18.04.

Credit

For the installation we follow the official Microsoft documentation, except for the launching of PowerShell preview, which we do with pwsh-preview, instead of pwsh.

https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6
https://github.com/PowerShell/PowerShell/releases
https://github.com/PowerShell/PowerShell/issues/7062