Installing .NET 6 on a Raspberry Pi Zero 2 W
Installing .NET6 on a Raspberry Pi can be quite easy, however with the different architecture of the Pi Zero 2 W some of the easier installs won't work. This post will show you a simple enough way of doing a .NET 6 install on a Pi Zero 2 W.
🎉As of 16 August 2022 it's now available via apt-get! 🥳🥳🥳
There's an extra step to get it to work for Debian if needed in the documentation.
The Original Post 👇
At the time of writing this, Microsoft has released installation documentation for Linux as it isn't as simple as a Windows installer:
However, the default Raspberry Pi OS package manager does not include .NET 6:
This leave us few options and the option I'll walk you through is the simplest way to use the
Installing .NET 6 Via Script
- Open a new terminal and run the install script. This installs and creates a hidden folder:
/home/pi/.dotnetwith the binaries
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin -c Current --runtime aspnetcore
- Open .bashrc for editing
- Export such that we can execute
dotnetfrom anywhere in the terminal by pasting the following at the bottom of .bashrc to update the PATH
export DOTNET_ROOT=$HOME/.dotnet export PATH=$PATH:$HOME/.dotnet
If you open a new terminal or run
source ~/.bashrc you should now be able to run commands:
Maybe One Day It Will Be Easier, with Snap
Outside of the native package manager, Microsoft prefers using Snap as the method to install .NET.
Snap is similar to
apt-get where you can install packages and they do have .NET offerings except not built for the Pi Zero 2 W architecture...
🤷 Or you know, maybe it will be added to
apt-get one day.
I originally had a lot of pain installing .NET 6 on the Pi Zero 2 W because of it's slightly different architecture and my own lack of Linux knowledge. The above is easy enough to consume even for a Windows person like myself and I hope it proves useful for you too!