| description | Information about installing PowerShell on Ubuntu |
|---|---|
| ms.date | 04/21/2026 |
| title | Install PowerShell 7 on Ubuntu |
There are multiple package versions of PowerShell 7 that can be installed. This article focuses on installing the latest stable release package. For more information about the package versions, see the PowerShell Support Lifecycle article.
Newer versions of PowerShell 7 replace existing previous versions of PowerShell 7. Preview versions of PowerShell can be installed side-by-side with other versions of PowerShell. Newer preview versions replace existing previous preview versions. If you need to run PowerShell 7.5 side-by-side with a previous version, reinstall the previous version using the binary archive method.
On Ubuntu Linux, you can install PowerShell using the universal .deb package from the Microsoft
package repository or by downloading a file from the stable release page.
Microsoft builds and supports a variety of software products for Linux systems and makes them available via Linux packaging clients (apt, dnf, yum, etc). These Linux software packages are hosted on the Linux package repository for Microsoft products, https://packages.microsoft.com, also known as PMC.
Installing PowerShell from PMC is the preferred method of installation.
Note
This script only works for supported versions of Ubuntu that have a package published to the Microsoft package repository. For other versions of Ubuntu, use the manual installation method.
#!/bin/bash
###################################
# Prerequisites
# Update the list of packages
sudo apt-get update
# Install pre-requisite packages.
sudo apt-get install -y wget apt-transport-https software-properties-common
# Get the version of Ubuntu
source /etc/os-release
# Download the Microsoft repository keys
wget -q https://packages.microsoft.com/config/ubuntu/$VERSION_ID/packages-microsoft-prod.deb
# Register the Microsoft repository keys
sudo dpkg -i packages-microsoft-prod.deb
# Delete the Microsoft repository keys file
rm packages-microsoft-prod.deb
# Update the list of packages after we added packages.microsoft.com
sudo apt-get update
###################################
# Install PowerShell
sudo apt-get install -y powershell
# Start PowerShell
pwshImportant
Ubuntu comes preconfigured with a package repository that includes .NET packages, but not PowerShell. Using these instructions to install PowerShell registers the Microsoft repository as a package source. You can install PowerShell and some versions of .NET from this repository. However, the Ubuntu package repository has different versions of the .NET packages. This can cause problems when installing .NET for other purposes. For more information about these problems, see Troubleshoot .NET package mix ups on Linux.
You must choose the feed you want to use to install .NET. You can set the priority of the package repositories to favor one over the other. For instructions on how to set the priorities, see My Linux distribution provides .NET packages, and I want to use them.
Download the universal package from the GitHub releases page. Select the URL of the package version you want to install.
- PowerShell 7.6 (LTS) universal package
https://github.com/PowerShell/PowerShell/releases/download/v7.6.1/powershell_7.6.1-1.deb_amd64.deb
- PowerShell 7.5 universal package
https://github.com/PowerShell/PowerShell/releases/download/v7.5.6/powershell_7.5.6-1.deb_amd64.deb
- PowerShell 7.4 (LTS) universal package
https://github.com/PowerShell/PowerShell/releases/download/v7.4.15/powershell_7.4.15-1.deb_amd64.deb
The following shell script downloads and installs the current preview release of PowerShell. You can change the URL to download the version of PowerShell that you want to install.
#!/bin/bash
###################################
# Prerequisites
# Update the list of packages
sudo apt-get update
# Install pre-requisite packages.
sudo apt-get install -y wget
# Download the PowerShell package file
wget https://github.com/PowerShell/PowerShell/releases/download/v7.5.6/powershell_7.5.6-1.deb_amd64.deb
###################################
# Install the PowerShell package
sudo dpkg -i powershell_7.5.6-1.deb_amd64.deb
# Resolve missing dependencies and finish the install (if necessary)
sudo apt-get install -f
# Delete the downloaded package file
rm powershell_7.5.6-1.deb_amd64.debAfter the package is installed, run pwsh from a terminal. If you have installed a Preview package,
run pwsh-preview.
- The location of
$PSHOMEvaries based on the package you installed.- For Stable and LTS packages:
/opt/microsoft/powershell/7/ - For Preview packages:
/opt/microsoft/powershell/7-preview/
- For Stable and LTS packages:
- The profiles scripts are stored in the following locations:
- AllUsersAllHosts -
$PSHOME/profile.ps1 - AllUsersCurrentHost -
$PSHOME/Microsoft.PowerShell_profile.ps1 - CurrentUserAllHosts -
~/.config/powershell/profile.ps1 - CurrentUserCurrentHost -
~/.config/powershell/Microsoft.PowerShell_profile.ps1
- AllUsersAllHosts -
- Modules are stored in the following locations:
- User modules -
~/.local/share/powershell/Modules - Shared modules -
/usr/local/share/powershell/Modules - Default modules -
$PSHOME/Modules
- User modules -
- PSReadLine history is recorded in
~/.local/share/powershell/PSReadLine/ConsoleHost_history.txt
The profiles respect PowerShell's per-host configuration, so the default host-specific profiles
exists at Microsoft.PowerShell_profile.ps1 in the same locations.
PowerShell respects the XDG Base Directory Specification on Linux.
sudo apt-get remove powershellPowerShell 7.2 and newer supports running on Ubuntu using 32-bit Arm processors. Use the binary archive installation method of installing PowerShell that's described in Alternate ways to install PowerShell on Linux.
[!INCLUDE Ubuntu support]
Microsoft supports the installation methods in this document. There may be other methods of installation available from other third-party sources. While those tools and methods may work, Microsoft can't support those methods.