PowerShell på Linux

Så er Microsoft Powershell kommet i version 7.0

Følgende linuxer er supporteret Ubuntu 16.04Ubuntu 18.04Ubuntu 18.10Ubuntu 19.04Debian 8Debian 9Debian 10CentOS 7Red Hat Enterprise Linux (RHEL) 7openSUSE 42.3openSUSE Leap 15Fedora 27Fedora 28, og Arch Linux.

Det hele ligger på github

Ubuntu 16.04

# Download Microsoft GPG nøgle
$ wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb

# Register Microsoft GPG nøgle
$ sudo dpkg -i packages-microsoft-prod.deb

# Aktivere "universe" pakken.
$ sudo apt-get update

# Installere PowerShell
$ sudo apt-get install -y powershell

# Start PowerShell
$ pwsh

Ubuntu 18.04

# Download Microsoft GPG nøgle
$ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb

# Register Microsoft GPG nøgle
sudo dpkg -i packages-microsoft-prod.deb

# Update the list of products
$ sudo apt-get update

# Aktivere "universe" pakken.
$ sudo add-apt-repository universe

# Installere PowerShell
$ sudo apt-get install -y powershell

# Start PowerShell
$ pwsh

For at fjerne den igen.

$ sudo apt-get remove powershell

 

Debian 8

# Install system components
$ sudo apt-get update
$ sudo apt-get install -y curl apt-transport-https

# Register Microsoft GPG nøgle
$ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
$ sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-jessie-prod jessie main" > /etc/apt/sources.list.d/microsoft.list'

# Update 
$ sudo apt-get update

# Installere PowerShell
$ sudo apt-get install -y powershell

# Start PowerShell
$ pwsh

Debian 9

# Install system components
$ sudo apt-get update
$ sudo apt-get install -y curl gnupg apt-transport-https

# Register Microsoft GPG nøgle
$ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
$ sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list'

# Update den.
$ sudo apt-get update

# Installere PowerShell
$ sudo apt-get install -y powershell

# Start PowerShell
$ pwsh

Debian 10

$ sudo apt-get update
# install the requirements
$ sudo apt-get install -y less locales ca-certificates libicu63 libssl1.1 libc6 libgcc1 libgssapi-krb5-2 liblttng-ust0 libstdc++6 zlib1g curl

# Download the powershell '.tar.gz' archive
$ curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.0.0-preview.4/powershell-7.0.0-preview.4-linux-x64.tar.gz -o /tmp/powershell.tar.gz

# Create the target folder where powershell will be placed
$ sudo mkdir -p /opt/microsoft/powershell/7-preview

# Expand powershell to the target folder
$ sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7-preview

# Set execute permissions
$ sudo chmod +x /opt/microsoft/powershell/7-preview/pwsh

# Create the symbolic link that points to pwsh
$ sudo ln -s /opt/microsoft/powershell/7-preview/pwsh /usr/bin/pwsh-preview

# Start PowerShell
$ pwsh-preview

Author:

Jeg er en professionel system administrator og grundlægger af linuxboxen.dk Jeg er en ivrig Linux-elsker og open source-entusiast. Jeg bruger Ubuntu og tror på at dele viden. Bortset fra Linux, elsker musik og dyr. Jeg er en stor fan af Dire straits.

Skriv et svar