How to Install PowerShell on Ubuntu 26.04 – Setup & Update Guide

Share

Powershell install guide ubuntu cover - PowerShell on Ubuntu 24.04 Install Guide (2025)You can install PowerShell on Ubuntu using the official Microsoft APT repository (for Ubuntu 24.04 and 22.04), the official Snap package (universal), and the GitHub .deb fallback (for Ubuntu 26.04).

Developed by Microsoft, PowerShell is a powerful task automation and configuration management framework consisting of a command-line shell and scripting language. Since it is cross-platform, it allows system administrators and DevOps engineers to manage mixed Windows and Linux environments directly from their Ubuntu machines.

This comprehensive guide provides detailed step-by-step terminal instructions for all three installation methods, compares their package performance, and covers critical configurations such as WinRM remoting and .NET package conflict resolution on Ubuntu 26.04, 24.04, and 22.04 LTS.

If you run into any setup issues, feel free to drop a comment below or contact us directly for support. Our team is always here to help you get it resolved.

Quick Facts & Requirements
• Microsoft’s official APT repository provides native deb packages for Ubuntu 24.04 and 22.04.
• The official Snap package is universal, auto-updating, and recommended for Ubuntu 26.04.
• The GitHub direct DEB download serves as a native fallback for Ubuntu 26.04.
• Remote management via WinRM requires installing the gss-ntlmssp authentication library.
• System requirements: amd64 or arm64 architecture, 1 GB RAM min, 500 MB disk space.
• Sudo administrator privileges are required for system-wide repository and package setups.

Ubuntu 22.04, 24.04 & 26.04  ·  Application Guide
Install PowerShell on Ubuntu
APT, Snap & GitHub Setup Guide

Configure Microsoft’s cross-platform scripting shell on your Ubuntu system. Compare native APT package configurations, snapd isolation, and direct release packages, then run verified installation commands.

Target OS: Ubuntu 22.04 / 24.04 / 26.04 LTS
Arch Support: amd64, arm64
Package Base: Official Stable
License: Open Source (MIT)

Quick CLI Setup Cheatsheet

If you are an experienced user looking for the fastest terminal commands, copy and paste the scripts below for your preferred setup method:

Snap Store (Universal & 26.04 Default)
sudo snap install powershell --classic
Uninstall: sudo snap remove powershell
APT Repository (Ubuntu 24.04 / 22.04)
sudo curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/powershell.gpg > /dev/null
ubuntu_version=$(lsb_release -rs)
ubuntu_codename=$(lsb_release -cs)
echo -e "Types: deb\nURIs: https://packages.microsoft.com/ubuntu/${ubuntu_version}/prod\nSuites: ${ubuntu_codename}\nComponents: main\nArchitectures: amd64\nSigned-By: /usr/share/keyrings/powershell.gpg" | sudo tee /etc/apt/sources.list.d/powershell.sources
sudo apt update && sudo apt install -y powershell
Uninstall: sudo apt purge powershell -y

Choosing the right installation method depends heavily on the version of Ubuntu you are running and whether you prefer native performance or sandboxed containerization. Review the release compatibility matrix below to determine which setup matches your workflow.

PowerShell Installation Methods Compared

Use the table below to compare how each installation method functions across different active Ubuntu LTS releases:

Method Ubuntu 26.04 Ubuntu 24.04 Ubuntu 22.04 Update Delivery
Microsoft APT Repo Not supported yet Fully supported Fully supported Automatic via APT
Snap Store (Official) Fully supported Fully supported Fully supported Automatic via snapd
GitHub Direct DEB Supported fallback Supported fallback Supported fallback Manual / Helper Script

Method 1: Install PowerShell via Microsoft APT Repository (For Ubuntu 24.04 & 22.04)

Setting up PowerShell using Microsoft’s official APT repository is the recommended method for Ubuntu 24.04 LTS (Noble Numbat) and 22.04 LTS (Jammy Jellyfish). This method registers the repository with your system package manager, which allows PowerShell to receive automatic security updates whenever you run standard system maintenance.

Modern Ubuntu installations handle software sources using the DEB822 configuration format. This standard replaces single-line repository strings with structured files that group package details and GPG validation paths cleanly.

Step 1
Update Dependencies and System Lists

Before registering the repository, update your package cache and install the necessary system utilities to manage secure downloads and keyrings:

sudo apt update && sudo apt install -y ca-certificates curl gnupg lsb-release

Step 2
Import the Microsoft GPG Security Key

Download Microsoft’s public security key and import it into a dedicated keyring. This key is used by APT to cryptographically verify that the packages you download are genuine and untampered:

sudo curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/powershell.gpg > /dev/null

Step 3
Register the DEB822 Sources Configuration

Create the sources list file using a structured layout. The script below reads your local Ubuntu version and codename dynamically, ensuring that the correct repository path is registered:

# Retrieve Ubuntu version details dynamically
ubuntu_version=$(lsb_release -rs)
ubuntu_codename=$(lsb_release -cs)

# Write the DEB822 configuration file
sudo tee /etc/apt/sources.list.d/powershell.sources <<EOF
Types: deb
URIs: https://packages.microsoft.com/ubuntu/$ubuntu_version/prod
Suites: $ubuntu_codename
Components: main
Architectures: amd64
Signed-By: /usr/share/keyrings/powershell.gpg
EOF

Step 4
Refresh Package Database and Install PowerShell

Update your local system package cache to detect the newly registered Microsoft source, then install the PowerShell package:

sudo apt update && sudo apt install -y powershell

Method 2: Install PowerShell via Snap Store (Universal & Recommended for 26.04)

The Snap package is the easiest, one-command installation method that works out of the box on Ubuntu. Because Microsoft does not yet publish package lists for Ubuntu 26.04 (Resolute Raccoon) in their APT repository, Snap is the recommended method for Ubuntu 26.04 users. Snaps are containerized packages that bundle all required libraries, run isolated from system packages, and update automatically in the background.

Snap Command
Install PowerShell from the Snap Store

Run the installation command in your terminal. We use the classic confinement flag to allow PowerShell to access system directories and commands outside the standard snap sandbox:

sudo snap install powershell --classic

Method 3: Install PowerShell via GitHub Release (Direct DEB for Ubuntu 26.04 Fallback)

If you prefer a native system installation on Ubuntu 26.04 instead of a containerized Snap, you can download the Debian package (`.deb`) directly from PowerShell’s GitHub release page. This manual method requires downloading the file and verifying its cryptographic checksum. Because direct packages do not link to an active repository, they do not update automatically via apt upgrade, so you must install updates manually or use a helper script.

Step 1
Download the Package and the Checksum Manifest

Fetch the desired PowerShell release package (such as version 7.6.2) and the corresponding verification manifest from the official repository. We dynamically detect the system architecture to download the correct package (`amd64` or `arm64`):

# Set target version and detect architecture
VERSION="7.6.2"
ARCH=$(dpkg --print-architecture)

# Download the correct deb package file
curl -L -O "https://github.com/PowerShell/PowerShell/releases/download/v${VERSION}/powershell_${VERSION}-1.deb_${ARCH}.deb"

# Download the checksum verification file
curl -L -O "https://github.com/PowerShell/PowerShell/releases/download/v${VERSION}/hashes.sha256"

Step 2
Verify File Integrity Using iconv and sha256sum

Microsoft saves the checksum file in UTF-16LE encoding, which cannot be processed by standard Linux verification tools directly. Convert the file encoding to UTF-8 using iconv, extract the line matching the package, and pass it to sha256sum to verify:

iconv -f utf-16le -t utf-8 hashes.sha256 | grep "powershell_${VERSION}-1.deb_${ARCH}.deb" | sha256sum -c -

If the check is successful, the terminal will print the package name followed by OK. If it prints a mismatch warning, delete the downloaded file and repeat the step.

Step 3
Install the Package via APT

Install the package using APT, which automatically resolves and retrieves any missing dependencies required by PowerShell:

sudo apt install -y "./powershell_${VERSION}-1.deb_${ARCH}.deb"

Automated Update Helper Script

To avoid repeating these download and verification steps manually, you can create a system script at `/usr/local/bin/update-powershell`. This helper queries the GitHub API to find the latest version tag, compares it with your installed version, downloads the package, converts and verifies the UTF-16LE checksum, and installs the update. It does not depend on python3.

Create and Configure the Helper Script

Create a new file at `/usr/local/bin/update-powershell` and add the script code below:

#!/bin/bash
# PowerShell on Linux Automated Update Script
set -e

# Retrieve latest version from GitHub API using grep and sed
latest_version=$(curl -s https://api.github.com/repos/PowerShell/PowerShell/releases/latest | grep '"tag_name":' | sed -E 's/.*"tag_name"[[:space:]]*:[[:space:]]*"v?([^"]+)".*/\1/')

if [ -z "$latest_version" ]; then
    echo "Error: Could not retrieve latest version from GitHub API."
    exit 1
fi

# Retrieve installed version
if command -v pwsh >/dev/null 2>&1; then
    current_version=$(pwsh -Version | sed 's/PowerShell //')
else
    current_version="none"
fi

echo "Installed PowerShell version: $current_version"
echo "Latest PowerShell version:    $latest_version"

if [ "$current_version" = "$latest_version" ]; then
    echo "PowerShell is already up-to-date."
    exit 0
fi

# Detect system architecture dynamically
arch=$(dpkg --print-architecture)
if [ "$arch" != "amd64" ] && [ "$arch" != "arm64" ]; then
    echo "Error: Architecture $arch is not supported by PowerShell official DEB packages."
    exit 1
fi

echo "Updating PowerShell to v$latest_version ($arch)..."
tmp_dir=$(mktemp -d)
cd "$tmp_dir"

deb_file="powershell_${latest_version}-1.deb_${arch}.deb"
deb_url="https://github.com/PowerShell/PowerShell/releases/download/v${latest_version}/${deb_file}"
hashes_file="hashes.sha256"
hashes_url="https://github.com/PowerShell/PowerShell/releases/download/v${latest_version}/${hashes_file}"

echo "Downloading $deb_file..."
curl -sSL -O "$deb_url"
echo "Downloading $hashes_file..."
curl -sSL -O "$hashes_url"

echo "Verifying SHA256 integrity..."
iconv -f utf-16le -t utf-8 "$hashes_file" | grep "$deb_file" | sha256sum -c -

echo "Installing package..."
sudo apt install -y "./$deb_file"

cd /
rm -rf "$tmp_dir"
echo "PowerShell update successfully completed."

Make the helper script executable so it can be run as a system command:

sudo chmod +x /usr/local/bin/update-powershell

PowerShell Screenshots

Important Gap Fix: Configure PowerShell Remoting (WinRM/NTLM & Kerberos)

Most system administrators deploy PowerShell on Linux to manage remote Windows servers. Out of the box, attempting to start a WinRM connection from Linux will fail because Linux lacks the native authentication providers required to communicate with Windows. Depending on your security needs, you can configure remoting using either NTLM (for local lab testing) or Kerberos (required for secure enterprise Active Directory environments).

Option 1
Local Testing via NTLM (gss-ntlmssp)

For local development or isolated testing environments, you can configure NTLM authentication by installing the GSS-NTLM security service provider package from the official Ubuntu repositories:

sudo apt update && sudo apt install -y gss-ntlmssp

Once installed, launch PowerShell (`pwsh`) and establish a remote session using NTLM. You can authenticate using an IP address or hostname:

# Launch PowerShell
pwsh

# Inside pwsh: request credentials and connect to target server
$cred = Get-Credential
New-PSSession -ComputerName "192.168.1.50" -Credential $cred -Authentication NTLM

Option 2
Secure Enterprise Authentication via Kerberos

For secure Active Directory domain environments, Kerberos is the mandatory authentication protocol. First, install the Kerberos client utility package on your Ubuntu machine:

sudo apt update && sudo apt install -y krb5-user

During installation, you will be prompted to enter your default domain realm (which must be capitalized, e.g. YOURDOMAIN.COM). Next, acquire a Kerberos ticket-granting ticket (TGT) for your AD user account:

kinit [email protected]

Once authenticated, launch PowerShell (`pwsh`) and open a remote session. When using Kerberos, you must connect using the target server’s Fully Qualified Domain Name (FQDN) that matches your Kerberos realm, not a raw IP address:

# Launch PowerShell
pwsh

# Inside pwsh: connect to target Windows server using Kerberos
New-PSSession -ComputerName "server01.yourdomain.com" -Authentication Kerberos

Configuring Your PowerShell Profile on Linux

PowerShell on Linux supports user profiles just like on Windows. You can use a profile script to set up custom terminal prompts, load custom modules, create path configurations, and register helpful aliases that load automatically when you open PowerShell.

Create and Configure the Profile Script

Launch PowerShell (`pwsh`) and run the script below to check for an existing profile. If none is found, the script creates the directory structure and a blank profile file:

if (!(Test-Path $PROFILE)) {
    New-Item -Type File -Path $PROFILE -Force
}

The profile file is saved under your home directory at `~/.config/powershell/Microsoft.PowerShell_profile.ps1`. Open this file with nano or a text editor and add your custom shell shortcuts:

# Add custom aliases
Set-Alias -Name ll -Value Get-ChildItem

# Custom shell prompt function
function prompt {
    $host.ui.Write("PS ", [ConsoleColor]::Cyan)
    $host.ui.Write($pwd.Path, [ConsoleColor]::DarkCyan)
    return "> "
}

Save the file and restart PowerShell. Your new profile shortcuts and prompt will load automatically.

Troubleshooting & Conflict Resolution

If you encounter warnings or crashes when configuring or starting PowerShell on Ubuntu, use the verified solutions below to resolve them.

How to Resolve Repository and Library Conflicts

Microsoft .NET Package Mix-ups and Dependency Conflicts

Registering the Microsoft APT repository can introduce package conflicts on Ubuntu. Both Ubuntu’s official repositories and packages.microsoft.com provide .NET SDK and runtime packages. If they mix, it can block updates or cause application crashes.

To fix this, write an APT preferences configuration file to prioritize Ubuntu’s native .NET packages while allowing PowerShell to be installed from Microsoft’s repository. Create the preference file:

sudo nano /etc/apt/preferences.d/99-microsoft-dotnet.pref

Add the pinning configuration rules:

Package: dotnet* aspnet* netstandard*
Pin: origin "packages.microsoft.com"
Pin-Priority: -10

Package: powershell
Pin: origin "packages.microsoft.com"
Pin-Priority: 990

Save the file and refresh your package lists to apply the rules:

sudo apt update

GPG Key Validation Errors during APT Updates

If you see repository signature verification errors during system updates, the Microsoft GPG key may be missing or corrupted. Remove the file and import a fresh copy of the security key:

sudo rm -f /usr/share/keyrings/powershell.gpg
sudo curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/powershell.gpg > /dev/null
sudo apt update

Shared Library and Startup Failures

If PowerShell crashes immediately on launch with library failures (e.g. missing `libssl` references or .NET errors), the binaries may have been corrupted during installation or system upgrades. Reinstall the package via APT to restore missing dependencies and libraries:

sudo apt update && sudo apt install --reinstall powershell

PowerShell Reset & Recovery Procedure

If PowerShell crashes on startup, fails to load system modules, or reports corrupt configuration files, you can perform a clean reset of your user configuration and reinstall the system packages:

1. Reset User Configurations and Session Profiles:

rm -rf ~/.config/powershell ~/.local/share/powershell

2. Force-Reinstall the PowerShell Package via APT:

sudo apt update && sudo apt install --reinstall powershell

How to Uninstall PowerShell from Ubuntu

If you need to remove PowerShell or clean up repository modifications made to your system, choose the commands below that correspond to your original setup method.

Uninstall Instructions for Each Method

1. Clean Up Microsoft APT Repository Installation:

Remove the package, delete the sources list, GPG keyring, and .NET repository pinning files, then refresh your package database:

sudo apt purge -y powershell
sudo rm -f /etc/apt/sources.list.d/powershell.sources
sudo rm -f /usr/share/keyrings/powershell.gpg
sudo rm -f /etc/apt/preferences.d/99-microsoft-dotnet.pref
sudo apt update

2. Clean Up Snap Store Installation:

Remove the snap package from your machine:

sudo snap remove powershell

3. Clean Up GitHub Direct DEB Installation:

Remove the system package and delete the automated update helper script:

sudo apt purge -y powershell
sudo rm -f /usr/local/bin/update-powershell

4. Optional: Delete User Settings, History, and Profiles:

The uninstall steps above do not delete your profile configurations or console history. Run the command below to delete remaining user settings directories:

rm -rf ~/.config/powershell ~/.local/share/powershell

Frequently Asked Questions

What is the difference between installing PowerShell via APT and Snap on Ubuntu?

The APT repository installs PowerShell as a native Debian package (.deb), offering faster startup times and direct integration with your system libraries. The Snap package runs in a secure, containerized sandbox and updates automatically in the background, making it the recommended and easiest method for Ubuntu 26.04 since Microsoft does not yet publish a native repository for it.

Why does Ubuntu 26.04 require a direct DEB download or Snap instead of the APT repository?

Ubuntu 26.04 LTS (Resolute Raccoon) is a newer release, and Microsoft has not yet added support for its codename (“resolute”) to the official packages.microsoft.com repository. Adding the Microsoft repository on Ubuntu 26.04 will result in APT 404 errors. You can install the official Snap package or download the standalone DEB package directly from PowerShell’s GitHub release page instead.

How do I update PowerShell on Ubuntu after installing it from a direct GitHub DEB package?

Because direct DEB packages are not linked to an active software repository, they do not update automatically via apt upgrade. You must manually download and install the new version, or use an automated update script. We provide a custom Bash helper script (/usr/local/bin/update-powershell) that queries the GitHub API, downloads the latest release, verifies its SHA256 checksum, and installs the update.

How do I fix the .NET package conflict warning when using Microsoft’s repository on Ubuntu?

Conflicts occur when Ubuntu’s official repositories and packages.microsoft.com both offer conflicting .NET runtime and SDK packages. To fix this, create a pinning configuration file at /etc/apt/preferences.d/99-microsoft-dotnet.pref. This configuration assigns a negative priority to .NET packages from packages.microsoft.com, forcing your system to use Ubuntu’s official .NET runtime while allowing powershell to install normally.

Why does PowerShell remoting (WinRM) fail on Ubuntu, and how do I fix it?

Out-of-the-box PowerShell remoting via WinRM fails on Linux because the NTLM authentication protocol is not supported natively. To resolve this issue, install the GSS-NTLM module by running sudo apt install -y gss-ntlmssp. Once installed, PowerShell can authenticate and open remote sessions using NTLM via the New-PSSession cmdlet.

Helpful Resources & Support

For further reading and community assistance with PowerShell on Linux, check these resources:

More Linux command line guides: Docker Setup  ·  Visual Studio Code  ·  Google Antigravity Setup