Installing PowerShell on Red Hat Enterprise Linux (RHEL)
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.3 is an in-place upgrade that removes previous versions of PowerShell.
If you need to run PowerShell 7.3 side-by-side with a previous version, reinstall the previous version using the binary archive method.
RHEL 7 uses yum and RHEL 8 uses the dnf package manager.
Installation via Package Repository
PowerShell for Linux is published to official Microsoft repositories for easy installation and updates.
On RHEL 7:
# Register the Microsoft RedHat repository
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
# Install PowerShell
sudo yum install --assumeyes powershell
# Start PowerShell
pwsh
As superuser, register the Microsoft repository once. After registration, you can update PowerShell
with sudo yum update powershell
.
On RHEL 8:
# 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 PowerShell
pwsh
As superuser, register the Microsoft repository once. After registration, you can update PowerShell
with sudo dnf upgrade powershell
.
Installation via direct download
Starting with version 7.2, PowerShell is distributed as a universal RPM package. Previous versions of PowerShell had separate package for each OS. Download the RPM package you need onto your CentOS machine.
- PowerShell 7.3.4 -
https://github.com/PowerShell/PowerShell/releases/download/v7.3.4/powershell-7.3.4-1.rh.x86_64.rpm
- PowerShell 7.2.11-
https://github.com/PowerShell/PowerShell/releases/download/v7.2.11/powershell-lts-7.2.11-1.rh.x86_64.rpm
Use the following shell command to install the latest RPM package on the target version of RHEL. Change the URL in the following shell commands to match the version you need.
On RHEL 7:
sudo yum install https://github.com/PowerShell/PowerShell/releases/download/v7.3.4/powershell-7.3.4-1.rh.x86_64.rpm
On RHEL 8:
sudo dnf install https://github.com/PowerShell/PowerShell/releases/download/v7.3.4/powershell-7.3.4-1.rh.x86_64.rpm
Uninstallation - Red Hat Enterprise Linux (RHEL) 7
sudo yum remove powershell
Support for Arm processors
PowerShell 7.2 and newer supports running on RHEL using a 64-bit Arm processor. Use the binary archive installation method of installing PowerShell that is described in Alternate ways to install PowerShell on Linux.
PowerShell paths
$PSHOME
is/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 is a list of currently supported versions of PowerShell and the versions of RHEL they're supported on. These versions remain supported until either the version of PowerShell reaches end-of-support or the version of RHEL reaches end-of-support.
- The
icon indicates that the version of the OS or PowerShell is still supported
- The
icon indicates the version of PowerShell is no longer supported on that version of the OS
- The
icon indicates that we haven't finished testing PowerShell on that OS
- The
icon indicates that the version of the OS or PowerShell isn't supported
- When both the version of the OS and the version of PowerShell have a
icon, that combination is supported
RHEL | 7.2 (LTS-current) | 7.3 | 7.4 (preview) |
---|---|---|---|
PowerShell is supported on RHEL for the following processor architectures.
RHEL | 7.2 (LTS-current) | 7.3 | 7.4 (preview) |
---|---|---|---|
All supported versions | x64 | x64 | x64 |
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