This is a post that I started more than a year ago. A goal was to be able to use a Raspberry Pi as a PowerShell Development environment. Whilst a lot has changed in that time (Powershell Core, Code Server and now the new Raspberry Pi 4) and a lot of progress made, I haven’t achieved my ultimate goal of using a Raspberry Pi as a development environment for Azure PowerShell Functions. But I’ve got very close with a key function being VSCode on Raspberry Pi. So I am posting this as I know I’ll need the reference when I need to setup a new Raspberry Pi or get the final mile working with local PowerShell Azure Functions development.
With that all said the latest Raspberry Pi’s (3B+ and 4B) are quite powerful and you can do quite a bit with them. As mentioned above one of the key functions to making a Raspberry Pi usable for PowerShell (Core) script development is a solid IDE. VSCode is that, but it is not available natively for Raspberry Pi yet. This post though details how to get it working using an open source project.
The key steps are;
- Raspbian for Raspberry Pi
- Install PowerShell Core
- Install dotnet Core
- Installing VSCode on Raspberry Pi
Bonus processes for;
- Docker on Raspberry Pi
- NodeJS installation on Raspberry Pi
Download and install Raspbian Stretch with Desktop from here. The installation page here has the process to write the image to an SD Card and get started. I use Etcher on both Mac and PC to write my SD Cards for Raspberry Pi images.
Install PowerShell Core
With your Raspberry Pi up and running Raspbian you can now install PowerShell Core.
The Microsoft documentation is very good. Checkout the Installation on Raspbian section here. Make sure to get the lastest release. You can check the latest releases here. You are looking for the powershell-VERSION-linux-arm32.tar.gz file
Install dotnet Core
To download and install 2.2.300 perform the following;
wget https://download.visualstudio.microsoft.com/download/pr/da881751-01f9-4ea0-8021-0b9c61d0cef6/87c4620dc5af2085d54e9860fad13552/dotnet-sdk-2.2.300-linux-arm.tar.gz mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-2.2.300-linux-arm.tar.gz -C $HOME/dotnet export DOTNET_ROOT=$HOME/dotnet export PATH=$PATH:$HOME/dotnet
Finally update your profile settings.
and add the following to the end of the Path line
and add the following to the end of the file
Install VSCode for Raspberry Pi
There are a number of different ways to get VSCode running on Raspberry Pi. Most of them involve compiling it for Raspbian with a bunch of dependencies. But this is 2019 and I figured there must be a simpler way. Recently I wrote about Code Server and I started wondering if that would be a nice solution.
Whilst the Raspberry Pi 3B+ is a 64bit ARM architecture, Raspbian is currently a 32bit OS. There are 64bit OS options available for Raspberry Pi, but I was keen to stick with Raspbian. However Code Sever does not currently have a 32bit version for ARM.
Some more searching and I found a community build for embedded linux systems including Raspberry Pi here.
I had to download the apt.sh script and make the following change to get it to install. Remark out the first apt-get install line and unremark the second line.
As it stands at the moment the latest version isn’t working on Raspberry Pi. Downgrade the version of VSCode to 1.29 and all works great.
apt-get install code-oss=1.29.0-1539702286
apt-mark hold code-oss
You can then run Code – OSS from the Applications or Programming menu category.
Install your favourite extensions or migrate them as I detailed in this post and you’ll be up and running.
Docker on Raspberry Pi
To install Docker I performed the following;
Install the prerequisite libraries;
sudo apt-get install software-properties-common -y
Get and install Docker
curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
To install NodeJS I performed the following;
curl -sL https://deb.nodesource.com/setup_11.x | sudo bash -
sudo apt-get install -y nodejs