#RP5: Setup a Raspberry Pi 5 for development

Some time ago the Raspberry Pi Foundation introduced the newly Raspberry Pi 5. Let’s setup and configure the device for development.

Sebastian Jensen
medialesson
6 min readApr 3, 2024

--

Introduction

Raspberry Pi is a series of small single-board computers. The Raspberry Pi project originally leaned towards the promotion of teaching basic computer science in schools. In this post I will show you how you can easily setup your Raspberry Pi 5.

Prepare the microSD card

The easiest way to prepare the microSD card is the usage of the free tool Raspberry Pi Imager provided by the Raspberry Pi Foundation. Just open the website raspberrypi.com/software and download and install the Raspberry Pi Imager tool for your operating system.

Now you can start the tool and luckily it is pretty simple.

First you need to select your device. Just click on the button CHOOSE DEVICE and select your Raspberry Pi device. In my case and for this blog post, we will select Raspberry Pi 5.

If you click on the button CHOOSE OS you’re able to select from a wide range of different operating systems. We select Raspberry Pi OS (other). Due to the fact that we want to use the Raspberry Pi headless, which means without a monitor and keyboard attached, I will select Raspberry Pi OS Lite (64-bit), because I don’t need the desktop environment.

Now we need to select the microSD card by clicking CHOOSE STORAGE. If everything is setup correctly, you can click on NEXT.

Now you are presented with a dialog and the question if you want to customize the operationg system. We click the button EDIT SETTINGS and adjust the settings.

We select a hostname, so it ist easier to find the device in the network. We also set the username and the password. Next step is setting up the wireless LAN connection, so the device is connected immediately with the internet. Finally we set the timezone and the keyboard layout.

On the SERVICES tab we enable SSH and use the password authentication. Otherwise we can’t connect to a headless Raspberry Pi.

We remove all the checkmarks on the OPTIONS tab and confirm by clicking SAVE.

Now we tap YES and confirm again by clicking YES to start the writing process. Keep in mind that all the data on your microSD card will be erased.

This process will take some minutes, depending on your internet connection and also the speed of your microSD card.

If the process has finished you will see the following dialog. You can now eject your card and insert it into the Raspberry Pi and connect the power supply.

First run of your Raspberry Pi 5

Now you need to wait a little bit, because the Raspberry Pi will configure the operating system. If everything is done and you see the green power led on the Raspberry Pi, you can open a Terminal on your machine and use ssh to connect to your device. You can either use ssh <username>@<yourhost> or you check on your router for the IP address of your Raspberry Pi and use ssh <username>@<ipaddress> to connect.

On the first connect you need to accept the fingerprint, by typing yes. As usual we need to update the operating system first. So type sudo apt-get update to check for the latest packages.

Next we use sudo apt-get upgrade to upgrade all available packages. You need to confirm the changes by typing Y to the console.

This process will take some time, depending on your internet connectivity and the amount of packages which need to be updated.

Install .NET

Due to the fact that I’m writing lots of .NET applications, I want to install .NET on my Raspberry Pi.

We can use the installation script provided by Microsoft to install .NET.

curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel LTS

Just wait a little bit to finish the installation. To simplify path resolution, we will add a DOTNET_ROOT environment variable and also add the .dotnet directory to the PATH variable.

echo 'export DOTNET_ROOT=$HOME/.dotnet' >> ~/.bashrc
echo 'export PATH=$PATH:$HOME/.dotnet' >> ~/.bashrc
source ~/.bashrc

Finally we can check the installation by trying to call dotnet --version. We should see the current version, which is currently 8.0.203.

Install Docker

I want to use docker and docker compose on my Raspberry Pi. Luckily there is an installation script available.

curl -fsSL https://get.docker.com -o get-docker.sh

In the next step we want to run the downloaded file.

sudo sh get-docker.sh

In order to have not to constantly type sudo in front of the docker commands, we simply add our user to the Docker group.

sudo usermod -aG docker $USER
newgrp docker

To verify the changes, we can use the docker version command.

Finally let’s use docker run hello-world to validate, that we are able to run Docker containers on our Raspberry Pi.

Conclusion

In this post I’ve explained how you can easily setup your Raspberry Pi 5 and configure it for your first steps. We prepared the microSD card and finished the setup process. We enabled SSH so that we can easily connect to the Raspberry Pi.

--

--

Sebastian Jensen
medialesson

Senior Software Developer & Team Lead @ medialesson GmbH