-
On Windows
-
On Linux
-
On macOS
-
Conclusion
PowerShell is a command-line shell, a scripting language, and a configuration management framework for developers, IT admins, and DevOps pros to automate tasks and eliminate manual labor and human mistakes. This article dwells on how to install it on the operating systems it supports.
On Windows
Supported OS:
Windows 10 1607+, Windows 11;
Windows Server Nano (1809 or higher);
Windows Server Core (2012 R2 or higher);
Windows Server 2012 R2;
Windows Server 2016, 2019, or 2022.
You can install PowerShell through the following methods:
Winget (recommended on Windows clients);
MSI package (Windows Servers and enterprise deployment);
ZIP package (Windows Nano Server, Windows IoT, and Arm-based systems);
.NET Global tool (.NET developers);
Microsoft Store package (infrequent users).
Winget:
1. In the Windows Package Manager, search for Command Prompt> right-click the result> choose Run as administrator.
2. Look for the newest version of PowerShell if you don’t know.
winget search Microsoft.PowerShell
3. Install with the following commands.
winget install --id Microsoft.Powershell --source winget
MSI package:
1. Download Windows x64 or x86 package.
2. Double-click the file and launch it via Windows Start Menu or run:
$env:ProgramFilesPowerShell7pwsh.exe
ZIP package:
Prerequisites for WSMan to work properly:
Windows Management Framework (WMF) 5.1;
Install Universal C Runtime for Windows before Windows 10.
1. Download x64, x86, or arm64 zip package.
2. Use the Unblock-File cmdlet to unblock the file.
3. Unzip the contents to the $env:ProgramFilesPowerShell7 folder.
4. Run pwsh.exe.
.NET Global tool:
1. Install the .NET Core SDK.
2. Install PowerShell.
dotnet tool install --global PowerShell
3. Start PowerShell from a new shell with pwsh commands.
Microsoft Store:
1. Launch Microsoft Store.
2. Click Get in Store app> Open> Install.
On Linux
PowerShell can be installed on multiple Linux distributions:
Alpine 3.14;
Debian 10, 11;
Red Hat Enterprise Linux (RHEL) 7, 8;
Ubuntu 18.04, 20.04, 22.04 LTS, Arm 32;
Raspberry Pi OS.
Alpine:
1. Download the tar.gz package.
2. Run the commands to install in the terminal.
# install the prerequisites
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
Curlhttps://github.com/PowerShell/PowerShell/releases/download/v7.3.2/powershell-7.3.2-linux-alpine-x64.tar.gz -o /tmp/powershell.tar.gz
# Create the destination folder in which PowerShell will be installed.
sudo mkdir -p /opt/microsoft/powershell/7
# Unzip powershell to the destination folder
sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7
# Specify the execute permissions
sudo chmod +x /opt/microsoft/powershell/7/pwsh
# Make a symbolic link pointing to pwsh.
sudo ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh
# Start PowerShell
pwsh
Debian:
1. Download the 7.3.2 package from the GitHub release page.
2. Run pwsh from a terminal.
Or install via package repository.
# Install system requirements
sudo apt update && sudo apt install -y curl gnupg apt-transport-https
# Add the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add –
# Register the Microsoft Product feed
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list'
# Install PowerShell
sudo apt update && sudo apt install -y powershell
# Start PowerShell
pwsh
Red Hat Enterprise Linux (RHEL):
Install via package repository.
# Register the Microsoft RedHat repository
curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
# Install PowerShell
sudo dnf install --assumeyes powershell
# Start it
pwsh
Or
1. download the PRM package.
2. Install the package.
sudo dnf install https://github.com/PowerShell/PowerShell/releases/download/v7.3.2/powershell-7.3.2-1.rh.x86_64.rpm
3. Run pwsh from a terminal.
Ubuntu:
1. Download the installer package.
2. Install the package with the shell commands.
# Install the package
sudo dpkg -i powershell-lts_7.3.2-1.deb_amd64.deb
# Solve missing dependencies and finish the installation (if needed)
sudo apt-get install -f
3. Run pwsh from a terminal.
Raspberry Pi OS:
1. Download the tar.gz package.
2. Run the commands to install.
# Prerequisites
# Update package lists
sudo apt-get update
# Install libunwind8 and libssl1.0
sudo apt-get install '^libssl1.0.[0-9]$' libunwind8 -y
# Get the latest tar.gz
wget https://github.com/PowerShell/PowerShell/releases/download/v7.3.2/powershell-7.3.2-linux-arm32.tar.gz
# Create folder to place powershell
mkdir ~/powershell
# Unpack the tar.gz file
tar -xvf ./powershell-7.3.2-linux-arm32.tar.gz -C ~/powershell
# Start PowerShell
~/powershell/pwsh
On macOS
Supported OS:
Big Sur 11.5 x64, Arm64
Install via Homebrew:
1. Install the Homebrew package manager if you cannot find the brew command.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2. Install PowerShell.
brew install --cask powershell
3. Run pwsh to verify.
Install directly:
1. Download the x64 or arm64 installation package.
2. Double-click the downloaded file and install from the terminal.
sudo installer -pkg powershell-7.3.2-osx-x64.pkg -target /
Note: if it cannot be opened because it is thought to be malicious software, try sudo xattr -rd com.apple.quarantine powershell-7.3.2-osx-x64.pkg with the full path to the .pkg file, and install it as usual.
3. Run pwsh.
.NET Global tool:
1. Install the .NET Core SDK.
2. Install PowerShell.
dotnet tool install --global PowerShell
3. Start PowerShell from a new shell with pwsh commands.
Binary archives:
1. Download the x64 or arm64 tar.gz package.
2. Install PowerShell.
# Download the powershell '.tar.gz' archive
curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v7.3.2/powershell-7.3.2-osx-x64.tar.gz
# Create the destination folder to put PowerShell
sudo mkdir -p /usr/local/microsoft/powershell/7.3.2
# Extract powershell to the folder
sudo tar zxf /tmp/powershell.tar.gz -C /usr/local/microsoft/powershell/7.3.2
# Specify execute permissions
sudo chmod +x /usr/local/microsoft/powershell/7.3.2/pwsh
# Make a symbolic link pointing to pwsh.
sudo ln -s /usr/local/microsoft/powershell/7.3.2/pwsh /usr/local/bin/pwsh
Conclusion
PowerShell makes up for the missing command-line interface with strong scripting ability in Microsoft and from then on, it gradually becomes one of the most widely used automation code tools for Windows, Linux, and Mac users.
Data can be corrupted or lost, however, due to all sorts of accidents like malware, or downtime. Consider Vinch Backup & Recovery, a compatible backup solution for 10+ virtualizations (VMware, XenServer, XCP-ng, Oracle OLVM, oVirt, etc.), NAS, Linux & Windows, and 6 databases.
Download the 60-day free trial to support your data protection now.
It automates the backup process under self-defined schedules and cuts down data size to half to save storage. While recovering crashed VM in a breeze from the backup repository in 15s for the minimal RTO. If you want to move data from one virtualization to another for better performance, you can also use it to perform smooth V2V migration without extra tools.
Share on: