Installing PowerShell Core on a Raspberry Pi isn’t as straightforward as some sites may lead you to believe…

You see, the Microsoft instructions assume AMD64 architecture… Vero and Raspberry are armhf.

Thus the instructions to use are: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-6#raspbian

Of course, check the following page to make sure the version numbers haven’t been updated: https://github.com/PowerShell/PowerShell/releases

# Install prerequisites
sudo apt-get install libunwind8

# Grab the latest tar.gz (ensure version number is up-to-date)
# Source Location: https://www.github.com/PowerShell/PowerShell/releases
# Note: You're looking for the LINUX-ARM32 link
sudo wget https://www.github.com/PowerShell/PowerShell/releases/download/v7.0.0-preview.5/powershell-7.0.0-preview.5-linux-arm32.tar.gz -P ~/Downloads/

# Or stable as per last update
sudo wget https://www.github.com/PowerShell/PowerShell/releases/download/v6.2.1/powershell-6.2.1-linux-arm32.tar.gz -P ~/Downloads/

# Make folder to put powershell
mkdir ~/powershell

# Unpack the tar.gz file (ensure version number is up-to-date)
tar -xvf ./Downloads/powershell-7.0.0-preview.5-linux-arm32.tar.gz -C ~/powershell

# Start PowerShell
~/powershell/pwsh

# Start PowerShell from bash with sudo to create a symbolic link
sudo ~/powershell/pwsh -c New-Item -ItemType SymbolicLink -Path "/usr/bin/pwsh" -Target "\$PSHOME/pwsh" -Force

sudo ~/powershell/pwsh -c New-Item -ItemType SymbolicLink -Path "/usr/bin/powershell" -Target "\$PSHOME/pwsh" -Force

# alternatively you can run following to create a symbolic link
# sudo ln -s ~/powershell/pwsh /usr/bin/pwsh
# sudo ln -s ~/powershell/pwsh /usr/bin/powershell

# Now to start PowerShell you can just run "pwsh" or "powershell"

As you can tell, in order to update PowerShell to the latest version, it would involve emptying the PowerShell directory, downloading the new tar.gz file and extracting to the PowerShell directory.

Leave a Reply

Your email address will not be published. Required fields are marked *