Installing PowerShell Core on Raspbian (Raspberry Pi)

PowerShell Core is a version of PowerShell that can be installed on Windows, Mac OS X (I covered it here) and Linux, i.e. Raspbian. For this blog post I am going to using my Raspberry Pi 4 and Raspbian (Buster).

“PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language.”

If you want to play with Microsoft Azure then you’ll want to take the PowerShell command line for a test drive as it can be better than the GUI driven web interface, and on Linux that means installing PowerShell Core.

First up, make sure to run sudo apt-get update.

geektechstuff_rasbian_powershell_core1
sudo apt-get update / sudo apt-get install

Next up we use wget to download the archive file that contains PowerShell Core for Raspbian.

wget https://github.com/PowerShell/PowerShell/releases/download/v6.2.0/powershell-6.2.0-linux-arm32.tar.gz

Note: Check https://github.com/PowerShell/PowerShell to check what the latest version is.

wget in action
wget in action

Once the archive file is download we need a location to extract it into.

mkdir ~/powershell

mkdir makes a directory, ~/ places it at the root of the folder tree and in this case the folder will be called powershell.

tar -xvf ./powershell-6.2.0-linux-arm32.tar.gz -C ~/powershell

The tar -xvf command extracts (-x) the file (f) verbosely (v) and copies it to the ~/powershell folder.

geektechstuff_rasbian_powershell_core3
Uncompressing the archive

With all that complete, it’s time to run PowerShell Core.

~/powershell/pswsh

pswsh is PowerShell Core and it should now open.

pwsh (PowerShell Core) in action
pwsh (PowerShell Core) in action

To check which version is installed type:

$psversiontable

With PowerShell Core installed and running the Azure module can be installed.

2 responses to “Installing PowerShell Core on Raspbian (Raspberry Pi)”

  1. SHA256 File Hash Values And How To Check Them (Raspberry Pi / Mac OS X / PowerShell) – Geek Tech Stuff Avatar

    […] This option also works in PowerShell Core for Mac OS X or Linux. […]

    Like

  2. Lionel Pérès Avatar
    Lionel Pérès

    Hello and really thank you for these explanations.
    I tried the installation.
    I started on a Rasp4 with Buster but I read in the doc that I had to use: Stretch
    So I started again, with a Raspi3b + and Stretch.

    Everything is well installed and your tutorial is fine but I block, I would like to use powershell to reach Teams.

    I tried to install
    Install-Module MicrosoftTeams –RequiredVersion 1.0.22 (on http://www.poshtestgallery.com)
    or stable version 1.0.6

    It does not work, the installation does not display any error but the module does not seem to be operational (Connect-MicrosoftTeams is not recognized)

    I realized on this page: https://docs.microsoft.com/fr-fr/microsoftteams/teams-powershell-overview that it was specified that the MicrosoftTeams module was needed but obviously also “PowerShell Skype for Business module “, but the link (https://www.microsoft.com/en-us/download/details.aspx?id=39366) leads to a Windows installation and not Linux. I did not find an order (type Install-Module xx to install it)

    Have you tried to install MicrosoftTeams on your powershell? Does it work? did i miss something?

    thank you so much

    Like

Welcome to GeekTechStuff

my home away from home and where I will be sharing my adventures in the world of technology and all things geek.

The technology subjects have varied over the years from Python code to handle ciphers and Pig Latin, to IoT sensors in Azure and Python handling Bluetooth, to Ansible and Terraform and material around DevOps.

Let’s connect