Install powershell to linux

Alternate ways to install PowerShell on 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.

There are three other ways to install PowerShell on a Linux distribution:

Snap Package

Snaps are application packages that are easy to install, secure, cross‐platform and dependency‐free. Snaps are discoverable and installable from the Snap Store. Snap packages are supported the same as the distribution you’re running the package on.

The Snap Store contains PowerShell snap packages for many Linux distributions that are not officially supported by Microsoft. For support, see the list of available Community Support options.

Getting snapd

snapd is required to run snaps. Use these instructions to make sure you have snapd installed.

Installation via Snap

PowerShell for Linux is published to the Snap store for easy installation and updates.

The preferred method is as follows:

# Install PowerShell sudo snap install powershell --classic # Start PowerShell pwsh 

To install the latest LTS version, use the following method:

# Install PowerShell sudo snap install powershell --channel=lts/stable --classic # Start PowerShell pwsh 

To install a preview version, use the following method:

# Install PowerShell sudo snap install powershell-preview --classic # Start PowerShell pwsh-preview 

After installation, Snap will automatically upgrade. You can trigger an upgrade using sudo snap refresh powershell or sudo snap refresh powershell-preview .

Uninstallation

sudo snap remove powershell 
sudo snap remove powershell-preview 

Binary Archives

PowerShell binary tar.gz archives are provided for Linux platforms to enable advanced deployment scenarios.

You can use this method to install any version of PowerShell including the latest:

Dependencies

PowerShell builds portable binaries for all Linux distributions. But, .NET Core runtime requires different dependencies on different distributions, and PowerShell does too.

It’s possible that when you install PowerShell, specific dependencies may not be installed, such as when manually installing from the binary archives. The following list details Linux distributions that are supported by Microsoft and have dependencies you may need to install. Check the distribution page for more information:

Читайте также:  Доменные группы astra linux

To deploy PowerShell binaries on Linux distributions that aren’t officially supported, you need to install the necessary dependencies for the target OS in separate steps. For example, our Amazon Linux dockerfile installs dependencies first, and then extracts the Linux tar.gz archive.

Installation using a binary archive file

This method can be used to install PowerShell on any version of Linux, including distributions that are not officially supported by Microsoft. Be sure to install any necessary dependencies. For support, see the list of available Community Support options.

The following example shows the steps for installing the x64 binary archive. You must choose the correct binary archive that matches the processor type for your platform.

  • powershell-7.3.6-linux-arm32.tar.gz
  • powershell-7.3.6-linux-arm64.tar.gz
  • powershell-7.3.6-linux-x64.tar.gz

Use the following shell commands to download and install PowerShell from the tar.gz binary archive. Change the URL to match the version of PowerShell you want to install.

# Download the powershell '.tar.gz' archive curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v7.3.6/powershell-7.3.6-linux-x64.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 

Uninstalling binary archives

sudo rm -rf /usr/bin/pwsh /opt/microsoft/powershell 

Install as a .NET Global tool

If you already have the .NET Core SDK installed, it’s easy to install PowerShell as a .NET Global tool.

dotnet tool install --global PowerShell 

The dotnet tool installer adds ~/.dotnet/tools to your PATH environment variable. However, the currently running shell does not have the updated PATH . You should be able to start PowerShell from a new shell by typing pwsh .

Feedback

Submit and view feedback for

Источник

Install PowerShell on Linux

PowerShell can be installed on different Linux distributions. Most Linux platforms and distributions have a major release each year, and provide a package manager that’s used to install PowerShell. This article lists the currently supported Linux distributions and package managers.

The rest of this article is a breakdown of each Linux distribution that PowerShell supports. All PowerShell releases remain supported until either the version of PowerShell reaches end-of-support or the Linux distribution reaches end-of-life.

For the best compatibility, choose a long-term release (LTS) version.

Alpine

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.

  • 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
Читайте также:  Linux добавить дату к имени файла

Alpine 3.15 is in the process of being tested.

PowerShell is supported on Alpine for the following processor architectures.

Alpine 7.2 (LTS-current) 7.3 7.4 (preview)
All supported versions x64 x64 x64

PowerShell hasn’t been tested on Alpine using Arm processors.

Debian

Debian uses APT (Advanced Package Tool) as a package manager.

The following table is a list of currently supported PowerShell releases and the versions of Debian they’re supported on. These versions remain supported until either the version of PowerShell reaches end-of-support or the version of Debian reaches end-of-life.

  • 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

PowerShell is supported on Debian for the following processor architectures.

Debian 7.2 (LTS-current) 7.3 7.4 (preview)
Version 9+ x64 x64 x64

Red Hat Enterprise Linux (RHEL)

RHEL 7 uses yum and RHEL 8 uses the dnf package manager.

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
Читайте также:  Лучшие дистрибутивы linux 2023

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

Ubuntu

Ubuntu uses APT (Advanced Package Tool) as a package manager.

The following table is a list of currently supported PowerShell releases and the versions of Ubuntu they’re supported on. These versions remain supported until either the version of PowerShell reaches end-of-support or the version of Ubuntu 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

Only the LTS releases of Ubuntu are officially supported. Microsoft does not support interim releases or their equivalent. Interim releases are community supported. For more information, see Community supported distributions.

PowerShell is supported on Ubuntu for the following processor architectures.

Ubuntu 7.2 (LTS-current) 7.3 7.4 (preview)
All supported versions x64, Arm32 x64, Arm32 x64, Arm32

Raspberry Pi OS

Raspberry Pi OS (formerly Raspbian) is a free operating system based on Debian.

.NET isn’t supported on ARMv6 architecture devices, including Raspberry Pi Zero and Raspberry Pi devices prior to Raspberry Pi 2.

Community supported distributions

There are many distributions of Linux that aren’t officially supported by Microsoft. In some cases, PowerShell may be supported by the community for these releases. For more information, see Community support for PowerShell on Linux.

CentOS and Fedora distributions are no longer supported. The versions of these operating systems that were supported have reached their end-of-life dates. We aren’t supporting any newer versions.

Alternate installation methods

There are three other ways to install PowerShell on Linux, including Linux distributions that aren’t officially supported. You can try to install PowerShell using the PowerShell Snap Package. You can also try deploying PowerShell binaries directly using the Linux tar.gz . For more information, see Alternate ways to install PowerShell on Linux.

Feedback

Submit and view feedback for

Источник

Оцените статью
Adblock
detector