🚪 Как установить Microsoft Powershell на Linux
PowerShell – это ответ Microsoft на командную строку Unix. Он мощный и в первую очередь предназначен для разработчиков, которым нужна надежная среда командной строки и скриптов.
Инструмент и среда PowerShell не являются эксклюзивными для пользователей Windows.
К удивлению многих, Microsoft сделала возможным использование их платформы PowerShell в других операционных системах, включая Linux.
Хотя большинство пользователей Linux сосредоточены на командной строке Unix, которую могут предложить все дистрибутивы, приятно видеть, что Microsoft размещает на платформе инструменты, связанные с Windows, такие как PowerShell, чтобы пользователи Linux, которым необходимо использовать Powershell, не нужно использовать операционную систему Microsoft.
Вот как установить Powershell на Linux.
Установите PowerShell в Linux
В Linux Microsoft предоставила пользователям Linux много разных способов наслаждаться PowerShell.
На данный момент существует пакет DEB для Ubuntu и Debian, RPM для Fedora, SUSE, CentOS (и других ОС RedHat), неофициальный пакет AUR и даже Snap, доступные для установки.
Чтобы заставить PowerShell работать на вашем ПК с Linux, откройте окно терминала, нажав клавиши Ctrl + Alt + T или Ctrl + Shift + T на клавиатуре.
Затем следуйте инструкциям, которые соответствуют дистрибутиву Linux, который вы используете в настоящее время.
Ubuntu
Это правда, что поскольку Ubuntu поставляется с Snap по умолчанию, пользователям, вероятно, следует установить релиз Snap, а не возиться с релизом PowerShell DEB.
Однако не каждый пользователь Ubuntu любит использовать Snaps, поэтому приятно видеть, что есть альтернативный способ установки программного обеспечения.
Чтобы получить пакет PowerShell Debian для вашего компьютера с Ubuntu, используйте инструмент загрузчика wget.
18.04 LTS
16.04 LTS
Когда файл пакета будет загружен, пришло время установить его в Ubuntu. Для этого используйте команду dpkg.
После установки пакета PowerShell DEB в Ubuntu вы можете увидеть ошибки, которые появляются в командной строке.
Не волнуйся; эти ошибки, скорее всего, просто проблемы с зависимостями. Чтобы исправить их, используйте команду apt install, как показано ниже.
Предполагая, что apt установка прошла успешно, вы сможете получить доступ к PowerShell в Ubuntu!
Debian
Microsoft поддерживает пользователей Debian с помощью пакета PowerShell DEB, однако официально они выпустили только один для Debian 9 Stable.
Это нормально, так как большинство пользователей еще не обновились до 10, но если вы все же используете 10, пропустите эти инструкции в пользу метода Snap.
Чтобы заставить PowerShell работать на Debian 9, запустите окно терминала.
Оттуда запустите следующую команду wget download, чтобы получить последнюю версию DEB приложения.
Когда пакет DEB будет загружен на ваш компьютер Debian, самое время начать установку. Для этого запустите dpkg.
После запуска команды dpkg в Debian могут возникнуть проблемы с зависимостями.
Чтобы это исправить, вы можете запустить apt-get install.
После исправления проблем с зависимостями (если они были), PowerShell будет готов к использованию!
Arch Linux
PowerShell от Microsoft доступен на Arch Linux AUR, поэтому, если вы хотите установить его на свой компьютер Arch, вам повезло.
Чтобы начать установку, откройте терминал и используйте пакет Pacman для загрузки Git и Base-devel в систему.
Следуя Git и Base-devel, клонируйте последний снэпшот Trizen AUR, чтобы упростить установку PowerShell.
Установите Trizen в систему, используя makepkg.
Наконец, установите последнюю версию Microsoft PowerShell на Arch Linux.
Fedora
Microsoft выпустила RPM-пакет для RedHat Enterprise Linux 7 и Fedora, который можно использовать для установки PowerShell.
Чтобы получить этот файл RPM-пакета, используйте wget для его загрузки. Затем установите с помощью Dnf.
OpenSUSE
Существует пакет RPM PowerShell, готовый для установки на OpenSUSE Leap 42.3, так что тем кто на SUSE повезло.
Однако, если вы используете 15.0 или Tumbleweed, рассмотрите вместо этого инструкции Snap.
Чтобы установить PowerShell на SUSE 42.3, начните с использования инструмента wget для загрузки последней версии файла RPM.
После завершения загрузки используйте Zypper для установки пакета.
Помимо создания нескольких пакетов для различных дистрибутивов Linux, Microsoft также решила загрузить PowerShell в хранилище пакетов Snap.
Итак, если вы используете дистрибутив Linux с поддержкой Snaps, вам повезло!
Чтобы установить Snap-релиз PowerShell, следуйте этому руководству, чтобы узнать, как настроить Snapd в вашей системе
Затем установите последнюю версию Microsoft PowerShell с помощью приведенной ниже команды мгновенной установки.
Доступ к PowerShell
Чтобы получить доступ к Microsoft PowerShell в Linux, запустите ваше любимое терминальное приложение для Linux.
Как только приложение откроется, выполните команду ниже.
Для получения справки по PowerShell выполните:
Источник
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 is used to install PowerShell. This article describes what is currently supported and which package manager is used.
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.
- 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 (current) | 7.2 (LTS-preview) |
---|---|---|---|
вњ… 3.12 | вњ… | вњ… | вќЊ |
вњ… 3.11 | вњ… | вњ… | вќЊ |
вќЊ 3.10 | рџџЎ | рџџЎ | вќЊ |
вќЊ 3.9 | рџџЎ | рџџЎ | вќЊ |
PowerShell has not been tested on Alpine versions 3.13 and 3.14.
CIM, PowerShell Remoting, and DSC are not supported on Alpine.
PowerShell is supported on Alpine for the following processor architectures.
Alpine | 7.0 (LTS) | 7.1 (current) | 7.2 (LTS-preview) |
---|---|---|---|
All supported versions | x64 | x64 | x64 |
PowerShell has not been tested on Alpine using Arm processors.
CentOS
CentOS 7 uses Yum as a package manager and CentOS 8 uses DNF.
The following table is a list of currently supported PowerShell releases and the versions of CentOS they are supported on. These versions remain supported until either the version of PowerShell reaches end-of-support or the version of CentOS reaches end-of-support.
- 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
CentOS | 7.0 (LTS) | 7.1 (current) | 7.2 (LTS-preview) |
---|---|---|---|
вњ… 8 | вњ… | вњ… | вњ… |
вњ… 7 | вњ… | вњ… | вњ… |
Microsoft does not officially support PowerShell on the CentOS Stream releases. For more information, see Comparing CentOS Linux and CentOS Stream. CentOS Stream is community supported. For more information, see Community supported distributions.
PowerShell is supported on CentOS for the following processor architectures.
CentOS | 7.0 (LTS) | 7.1 (current) | 7.2 (LTS-preview) |
---|---|---|---|
All supported versions | x64 | x64 | x64 |
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.
- 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
Debian | 7.0 (LTS) | 7.1 (current) | 7.2 (LTS-preview) |
---|---|---|---|
вњ… 10 | вњ… | вњ… | вњ… |
вњ… 9 | вњ… | вњ… | вќЊ |
вќЊ 8 | рџџЎ | вќЊ | вќЊ |
PowerShell is supported on Debian for the following processor architectures.
Debian | 7.0 (LTS) | 7.1 (current) | 7.2 (LTS-preview) |
---|---|---|---|
Version 9+ | x64, Arm32, Arm64 | x64, Arm32, Arm64 | x64, Arm32, Arm64 |
Fedora
Fedora uses DNF as its package manager.
The following table lists the supported PowerShell releases and the versions of Fedora they’re supported on. These versions are supported until either the version of PowerShell reaches end-of-support or the version of Fedora 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
Fedora | 7.0 (LTS) | 7.1 (current) | 7.2 (LTS-preview) |
---|---|---|---|
вњ… 32 | рџџЎ | рџџЎ | вќЊ |
вќЊ 31 | рџџЎ | рџџЎ | вќЊ |
вќЊ 30 | рџџЎ | рџџЎ | вќЊ |
PowerShell has not been tested on Fedora versions 33 and 34.
PowerShell is supported on Fedora for the following processor architectures.
Fedora | 7.0 (LTS) | 7.1 (current) | 7.2 (LTS-preview) |
---|---|---|---|
All supported versions | 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 are 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.
- 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
RHEL | 7.0 (LTS) | 7.1 (current) | 7.2 (LTS-preview) |
---|---|---|---|
вњ… 8 | вњ… | вњ… | вњ… |
вњ… 7 | вњ… | вњ… | вњ… |
PowerShell is supported on RHEL for the following processor architectures.
RHEL | 7.0 (LTS) | 7.1 (current) | 7.2 (LTS-preview) |
---|---|---|---|
All supported versions | x64 | x64 | x64, Arm64 |
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 are 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.
- 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
Ubuntu | 7.0 (LTS) | 7.1 (current) | 7.2 (LTS-preview) |
---|---|---|---|
вњ… 20.04 (LTS) | вњ… | вњ… | вњ… |
вњ… 18.04 (LTS) | вњ… | вњ… | вњ… |
вќЊ 16.04 (LTS) | рџџЎ | рџџЎ | вќЊ |
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.0 (LTS) | 7.1 (current) | 7.2 (LTS-preview) |
---|---|---|---|
All supported versions | x64, Arm32, Arm64 | x64, Arm32, Arm64 | x64, Arm32, Arm64 |
Raspberry Pi OS
Raspberry Pi OS (formerly Raspbian) is a free operating system based on Debian.
.NET is not 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 are not 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.
Источник