Raspberry Pi 5 server setup.

I wanted a relatively cheap and sturdy server. And with some Raspberry Pi experience under my belt, I choose the RPi platform.

Next, I wanted to boot from an SSD drive. I investigated the capabilities of the RPi 4, of which I have a few lying around. However, the ability to boot from SSD would require quite a bit of an upgrade. Also the RPi 4’s I had at my disposal were only 1GB and 2GB ram versions. I then did some reading on the RPi 5’s capabilities.

  1. PCIe port (makes it possible to add a low power NVMe SSD, compared to a standard 2.5″ SATA SSD)
  2. Computing power ~3 times that of the RPi 4!

So the conclusion became to to buy the following hardware for this server setup.

  1. Raspberry Pi 5, 4GB
  2. Pimoroni NVMe Base
  3. Samsung 980 PRO NVMe M.2 SSD
  4. DeLock USB 3.2 Gen 2 to M.2 Converter

You’ll also need a Micro SD card for your initial server OS.

Server software

In order to be able to boot from the NVMe SSD, a server installation supporting boot from PCIe. As this is a server setup, I have no need for a graphical UI. Therefore, my choice fell on “Raspios Bookworm arm64 Lite” Make sure to pick the Bookworm version, older versions don’t support boot over PCIe.

Navigate to “https://www.raspberrypi.com/software/operating-systems/” and scroll down to the “Raspberry Pi OS (64-bit)” section. Download the “Raspberry Pi OS Lite” version.

I use Raspberry Pi imager to flash the disc image to the RPi Micro SD card.

Imager

Select the disc image you downloaded earlier. Insert your Micro SD card in your computer. You can use either a Micro SD to USB or a Micro SD to SD adapter. Then select your SD card in the ‘Storage’ selector. Now click ‘NEXT’.

You can now change the basic setup for the RPi. Click ‘EDIT SETTINGS’.

Imager - Settings

Now add a good hostname. This is important for later SSH’ing into the server. Set a user name and password. This will also be used, when doing SSH. If you want your server to be able to connect to your home network, either connect a network cable between your router and your RPi. Or setup the wifi network credentials. This makes you RPi server connect to your wifi network on boot.

Imager - Custom

Now switch to the ‘SERVICES’ tab.

Imager - Custom1

Make sure to Enable SSH, you can then decide which type of authentication you want to use for SSH.

  • Password authentication (This means that any device capable of SSH on your network can login to the server if they know your username and password)
  • Only allow public-key authentication (Saver than password authentication, since only devices with allowed public-keys will be able to login)

Now you can save your server configuration and go on with flashing the Micro SD card, by clicking YES.

Once the image has been flashed to the Micro SD card, you can unmount the card. You’re now ready to do the first boot of your RPi server. Now place the Micro SD card in the RPi and connect the power cord.

Now, hopefully your RPi server has booted up. Check your router to see if your RPi server shows up and is assigned an IP address. At this point you could decide whether to assign a fixed IP address to your RPi server.

Next step is to enable the PCIe port on the RPi 5. I’m using Linux mint so I will show how it’s done here. Open a terminal and SSH into the RPi server, using “ssh user@hostname.local” or “ssh user@ip-address“. Below, I’m using the latter option.

SSH login

A successful login will result in a terminal prompt on the RPi server host. All commands entered here will be running on the RPi server.

We start by enabling the PCIe port, in the boot config.

sudo nano /boot/firmware/config.txt

Add “dtparam=pciex1

Config

Press CTRL+S to save. Then CTRL+X to exit

Now reboot the server “sudo reboot” or “sudo shutdown -r now

After reboot, SSH into the server again. Now run these commands to ensure that the system is up to date.

sudo apt update

sudo apt upgrade

sudo rpi-eeprom-update -a

Now the RPi server is up to date. We now need to get the server image on to the SSD drive. There are several options for doing this. However, I have chosen to buy a USB to M.2 converter. So I’m mounting the SSD drive in the converter. Then I connect it to my computer. It shows up as any other USB storage device, ready for use.
I then fire up Raspberry Pi imager once again. In the operating system selection, add the Raspios image downloaded earlier. In the Storage section, select your SSD drive.

Now click NEXT

Now click EDIT SETTINGS, check that all settings are the same as for the 1’st SD installation.

Click SAVE to save the settings, then click YES to flash these settings onto the SSD drive.

Once the SSD drive is ready, close Raspberry Pi imager. Now open Discs from the Accessories menu. Select your USB attached SSD drive. You should see 2 partitions – bootfs and rootfs

There should also be some free space. In my case there was about 990GB of free space. I then added an ext4 partition labeled data and resized it to 900GB. This leaves about 10% unused disk space, which will prolong the longevity of the drive.

Now save the changes to the disc and close the program.

Open a file explorer. Select bootfs. Open the config.txt file. Add the line dtparam=pciex1. Save the file.

Now we have the same configuration as we do on our original SD card.

Unmount the SSD drive and remove it from the computer. Move the NVMe SSD from the USB converter to the Pimoroni NVMe base board.

Switch off the RPi server and disconnect the power cord. Follow the instructions to attach the NVMe board to the RPi.

Once everything has been put together, you can power up your RPi server again. Still using the SD card to boot from.

Once the RPi server is back online, SSH into it. Now run sudo rpi-eeprom-config –edit

RPi EEPROM

Change BOOT_ORDER to 0xf416, this will move the PCIe SSD drive up front in the boot order.

While you’re here change the POWER_OFF_ON_HALT to 1, this will save some power when server is turned off.

Now save and exit with CTRL+S and CTRL+X

Shut down the RPi server with sudo shutdown now

Remove the power cord and then remove the SD card.

Attach the power cord again, and the RPi server should now be booting from your SSD drive. You can check your router to see if shows up in the list of connected devices.

The final step is now to make sure the system is up to date.

SSH into the RPi. run the following commands.

sudo apt update

sudo apt upgrade

Congratulations!

Now you should be ready to start installing whatever you want your new server to be used for.


Comments

One response to “Raspberry Pi 5 server setup.”

  1. Sebastian avatar
    Sebastian

    That was a great read. Will try it myself!

Leave a Reply

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