How to Install PowerShell

From Linux Delta
Jump to: navigation, search

How to Install PowerShell

Author: dm

Overview

The following guide will walk you through installing PowerShell. PowerShell is a cross-platform (Windows, Linux, and macOS) Shell with automation and configuration tool/framework that works well with your existing tools and is optimized for dealing with structured data (e.g. JSON, CSV, XML, etc.), REST APIs, and object models. It includes a command-line shell, an associated scripting language and a framework for processing cmdlets.

System Requirements

1. A Machine with Linux

Install via Snap Step-By-Step Guide

sudo snap install powershell
# Start PowerShell
pwsh

Install on Ubuntu 18.04 LTS Step-By-Step Guide

# Download the Microsoft repository GPG keys
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb
# Update the list of products
sudo apt-get update
# Enable the "universe" repositories
sudo add-apt-repository universe
# Install PowerShell
sudo apt-get install -y powershell
# Start PowerShell
pwsh


Install on CentOS 7 Step-By-Step Guide

# 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 -y powershell
# Start PowerShell
pwsh

Install on Red Hat Enterprise Linux (RHEL) 7 Step-By-Step Guide

# 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 -y powershell
# Start PowerShell
pwsh


Install on Fedora 28, 29, and 30 Step-By-Step Guide

# Register the Microsoft signature key
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
# Register the Microsoft RedHat repository
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
# Update the list of products
sudo dnf update
# Install a system component
sudo dnf install compat-openssl10
# Install PowerShell
sudo dnf install -y powershell
# Start PowerShell
pwsh

Additional Information

go to https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux for additional information