To install PowerShell on Ubuntu, add Microsoft’s package repository and install the powershell package with apt, then start it with pwsh. The same steps work on Ubuntu 22.04, 24.04 and 26.04, on a server or in WSL.
I first wrote this for Ubuntu 20.04 in WSL, which has since reached the end of its support. The commands below look up your Ubuntu version for you, so they work unchanged on whichever release you are on.
Install PowerShell
# Prerequisites sudo apt-get update sudo apt-get install -y wget apt-transport-https software-properties-common # Download and register Microsoft's repository for your Ubuntu version source /etc/os-release wget -q https://packages.microsoft.com/config/ubuntu/$VERSION_ID/packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb rm packages-microsoft-prod.deb # Install PowerShell sudo apt-get update sudo apt-get install -y powershell
source /etc/os-release sets $VERSION_ID to your release (for example 24.04), so the download matches your system. The older version of this post skipped the download line, so the dpkg step failed with “cannot access archive”. Microsoft’s Install PowerShell on Ubuntu page lists which releases are supported.

Start PowerShell and Check the Version
pwsh

Inside PowerShell, check which version you have:
$PSVersionTable.PSVersion

Type exit to go back to bash. To update PowerShell later, it updates with everything else: sudo apt-get update && sudo apt-get upgrade.
The screenshots are from my 2022 install. More on checking versions, including on Windows, is in How to Check Your PowerShell Version, and the Windows install is in Install PowerShell 7 on Windows. Other installs on the same Ubuntu: Ubuntu on WSL itself, the AWS CLI and PostgreSQL. Every other WSL post is in the WSL Complete Guide.
If SQL Server is part of your day job, my current work lives over at sqldba.blog: production DBA scripts, an error library and the SSMS guide.