Installing PowerShell on Alpine Linux
All packages are available on our GitHub releases page. After the package is installed,
run pwsh from a terminal. Run pwsh-preview if you installed a preview release. Before
installing, check the list of Supported versions below.
Note
PowerShell 7.2 is an in-place upgrade that removes previous versions of PowerShell.
If you need to run PowerShell 7.2 side-by-side with a previous version, reinstall the previous version using the binary archive method.
Installation steps
Installation on Alpine is based on downloading tar.gz package from the releases page. The URL to the package depends on the version of PowerShell you want to install.
- PowerShell 7.2.5 -
https://github.com/PowerShell/PowerShell/releases/download/v7.2.5/powershell-7.2.5-linux-alpine-x64.tar.gz - PowerShell 7.0.11 -
https://github.com/PowerShell/PowerShell/releases/download/v7.0.11/powershell-7.0.11-linux-alpine-x64.tar.gz
Then, in the terminal, execute the following shell commands to install PowerShell 7.2:
# install the requirements
sudo apk add --no-cache \
ca-certificates \
less \
ncurses-terminfo-base \
krb5-libs \
libgcc \
libintl \
libssl1.1 \
libstdc++ \
tzdata \
userspace-rcu \
zlib \
icu-libs \
curl
sudo apk -X https://dl-cdn.alpinelinux.org/alpine/edge/main add --no-cache \
lttng-ust
# Download the powershell '.tar.gz' archive
curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.2.5/powershell-7.2.5-linux-alpine-x64.tar.gz -o /tmp/powershell.tar.gz
# Create the target folder where powershell will be placed
sudo mkdir -p /opt/microsoft/powershell/7
# Expand powershell to the target folder
sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7
# Set execute permissions
sudo chmod +x /opt/microsoft/powershell/7/pwsh
# Create the symbolic link that points to pwsh
sudo ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh
# Start PowerShell
pwsh
Uninstall PowerShell from Alpine
sudo rm -rf /usr/bin/pwsh /opt/microsoft/powershell
PowerShell paths
$PSHOMEis/opt/microsoft/powershell/7/- User profiles are read from
~/.config/powershell/profile.ps1 - Default profiles are read from
$PSHOME/profile.ps1 - User modules are read from
~/.local/share/powershell/Modules - Shared modules are read from
/usr/local/share/powershell/Modules - Default modules are read from
$PSHOME/Modules - PSReadLine history is recorded to
~/.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.
Supported versions
The following table lists the supported PowerShell releases and the versions of Alpine they're supported on. These versions are supported until either the version of PowerShell reaches end-of-support or the version of Alpine reaches end-of-life.
- A ✅ indicates that the version of the OS or PowerShell is still supported
- A ❌ indicates that the version of the OS or PowerShell isn't supported
- A 🟡 indicates the version of PowerShell is no longer supported on that version of the OS
- When both the version of the OS and the version of PowerShell have ✅, that combination is supported
| Alpine | 7.0 (LTS) | 7.1 | 7.2 (LTS-current) | 7.3 (preview) |
|---|---|---|---|---|
| ✅ 3.14 | ❌ | 🟡 | ✅ | ✅ |
| ✅ 3.13 | ❌ | 🟡 | ✅ | ✅ |
| ✅ 3.12 | ✅ | 🟡 | ✅ | ✅ |
| ✅ 3.11 | ❌ | 🟡 | ❌ | ❌ |
| ❌ 3.10 | 🟡 | 🟡 | ❌ | ❌ |
| ❌ 3.9 | 🟡 | 🟡 | ❌ | ❌ |
Alpine 3.15 is in the process of being tested for PowerShell 7.3 (preview).
PowerShell is supported on Alpine for the following processor architectures.
| Alpine | 7.0 (LTS) | 7.2 (LTS-current) | 7.3 (preview) |
|---|---|---|---|
| All supported versions | x64 | x64 | x64 |
PowerShell hasn't been tested on Alpine using Arm processors.
Installation 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 cannot support those methods.
Feedback
Submit and view feedback for