Beginning of last summer I wrote an article walking through the steps for spawning a #RaspberryPi 4 with #RaspberryPiOS. Now I received a new #RaspberryPi5 and I revisited the article, spotting some changes and also installing the last #Bookworm over a #SATA3 #SSD besides a MicroSD.

Overview

This article intends to go through all steps from the delivered plain Raspberry Pi until a working-and-ready-for-playing host connected to the network. I divided the article in the following sections:

  1. Before we start
  2. Raspberry Pi Imager
  3. First Raspberry start
  4. Setting up the network configuration
  5. Activate the basics in the .bashrc file
  6. Setting up the Key pair
  7. Wrapping up

0. Before we start

ℹ️ This article is a revision of the previous Spawning a Raspberry Pi 4 with Raspberry Pi OS from June 2023. The 3 big differences are:

  • The machine used is now a Raspberry Pi 5, the new hardware from the Raspberry Pi foundation that just arrived to play with.

  • Installing the latest Bookworm Debian version. In this article, this change only brings the Network Manager besides dhcpcd as a tool to set up the network configuration. It is now the standard and I reflect it here.

  • Installing over a SSD disk besides a Micro SD card. This way I ilustrate that with the modern Raspberry Pi machines is it really easy and painless to boot from a SSD besides from a Micro SD, improving the performance and the reliability, specially for projects that make a higher use of the disk. If you still want to use a Micro SD card, take a look at the previous article.

But Xavi, why don't we make use of the beautiful PCIe that comes with the new Raspberry PI 5? Not this time, as I already had a spare SSD 64GB with its dongle, but I will do it out in another article!

For the rest, the article is mostly the same, aiming to serve as a basis for further Raspberry Pi projects.

0.1. What do I need?

Firstly we need the basics:

  • A Raspberry Pi 5, of course. I assume here the related power cable and also a network patch cable as I'll use a wired connection.

  • A SSD SATA III disk with the related SATA III to USB 3 cable. As I mention above, I wanted to introduce a better performing option while in a very contained cost, and show that at the end of the road it does not make the installation more complex. If you still want to use a Micro SD card I recommend a SanDisk Extreme A1 32GB as a good balance between performance and cost.

  • We also need a secondary computer to burn the official image into the disk. I use my everyday laptop for it.

On a second level let me add:

  • A USB keyboard

  • A screen with a mini-HDMI connector.

Why? I like to do the first start physically, to see the boot sequence, to set up the network statically, and then all the rest I can do remote. Allows me to be versatile if anything pops up. I always have a spare USB Keyboard at home and any of my monitors have a spare video connection I can use.

Anyways, it is not really needed. As long as the SSH server can be set up when we install the system into the micro-SD card, we can just check the router to recognise the new IP in the network and then SSH into the host and do everything in this article remotely. Your choice 😊

0.2. What is the goal for this host?

This seems obvious but makes sense: the goal of the host shapes the installation that we do.

For instance, in my case I usually set my Raspberries in a cluster setup I printed myself, as they provide services and are not really accessed directly by humans. This means mainly:

  • No wireless, they are all wired to a switch.

  • Headless, they will be accessed via SSH only.

This tell us that we don't need a graphic desktop when choosing which OS to install, and that we won't set up the wifi.

Your needs can be different, just have a thought about it beforehand.

0.3. Assumtions

  • The hostname will be jakku

  • The username will be xavi

  • The goal is providing a service, so headless and no wireless.

  • There is a local DNS server called dagobah in 192.168.1.231 that we'll make use of, as I set up in the past article Quick DNS server on a Raspberry Pi.

  • My secondary computer is a Mac laptop. Steps may be somewhat different to the ones you may need to do.

1. Raspberry Pi Imager

Nowadays the ecosystem is really easy to set the Raspberries up. We have a new official Raspberry Pi OS in place of the old Raspbian, and the guys behind the project brought the Raspberry Pi Imager, a SD card burner that does almost everything for you. We'll use all of if.

1.1. Download and install Raspberry Pi Imager in your computer

This is the easiest step. Just visit the official Raspberry Pi Software section and download the Raspberry Pi Imager that fits with your laptop's OS. Then proceed to install it the way your OS likes to have things done.

It is really simple, but if you still need help, visit the official documentation.

1.2. Install the Raspberry Pi OS into the SSD

Now we connect the SSD to the SATAII to USB3 cable, then to the laptop, and start the Raspberry Pi Imager. A screen will appear with 2 white buttons and a 3rd one greyed.

1.2.1. Operating system

Pressing the Choose OS button allows us to select which operating system do we want to install into the micro-SD card. We have here a Raspberry Pi 5, so it is a 64 bits one. Also we know we want it headless and that we want the official Raspberry Pi OS, so our selection should be Raspberry Pi OS Lite (64-bit) under Raspberry Pi OS (other)

raspberry-pi-os-lite-64

1.2.2. Storage

Pressing the Choose Storage button allows to select the SSD disk where we'll install the Raspberry Pi OS into.

SSD-SATA

1.2.3. Advanced options

Once we have chosen the Operating system, a button with a gear appears in the lower right corner. This is the advanced options that we'll make use of, as it allows us to pre-configure some parameters that helps us in the first start of the host.

➡️ Set hostname

Mark it and introduce here the name of the host that we want to asign to this machine. I introduced jakku

➡️ Enable SSH

Yes, mark it, and mark also Use password authentication.

➡️ Set username and password

Yes, mark it, and set the username and password that you wish. xavi as username in my case.

➡️ Configure wireless LAN

Not in my case, as explained above. This would be the place to set up your wireless configuration if you want to have it wireless.

➡️ Set locale settings

Yes, mark it and set the Time zone and Keyboad layout that fits best to you. Europe/Berlin and us for me.

➡️ Persistent settings

Here I recommend to mark at least the Eject media when finished, so this step is automatically done and make the process easier for the user.

... and press Save when you're done.

💡Making use of these Advanced options is the best tool to achieve a completely headless installation, as you can set up the Wifi, username, hostname and SSH server beforehand and once the Raspberry Pi does the first start you'll be ready to SSH into it and continue the set up.

1.2.4. Write

Pressing the Write button will start the process of installing the Raspberry Pi Imager into the micro-SD card and will notice us when it's done, auto-ejecting it for our convenience.

burning-the-image

1.2.4. Enable 5V 5A in USB for booting

The only difference when it comes to installing between the Micro SD card and the SSD drive is that the Raspberry Pi 5 will complain if it detects a USB drive but the config.txt does not have the parameter usb_max_current_enable=1 in it.

raspberry-pi-5-usb-power

So, once we're aware that the USB unit needs power and we're sure that we're feeding the unit properly, and as we have the unit still connected to the secondary computer, we open the file config.txt and add the following line:

# Enable USB 5V 5A
usb_max_current_enable=1

After that, we save the file, remove safely the disk and we get ready to connect everything into the Raspberry Pi.

2. First Raspberry Pi start

Connect the SSD & SATA II USB cable to the Raspberry Pi, make sure the network patch cable, HDMI and the USB keyboard are also connected, and connect the power cable, which will automatically power the machine.

It will initiate and do a first quick step and proceeds to reboot. You'll see in the screen the list of actions and appearing and scrolling, until leaving you prompting for the login username and password under the hostname, which is already the ones we set up in the Raspberry Pi Imager. Proceed with the login.

2.1. Initial setup with raspi-config

Once we're logged, type:

sudo raspi-config

... and a text-based graphical tool will appear, that will help us to do the final touches to our Raspberry Pi

➡️ Enable SSH

It should be already enabled by the setup in the Raspberry Pi Imager, but just in case:

  1. Select 3 Interface Options and then I2 SSH.

  2. It asks Would you like the SSH server to be enabled? And we select Yes. A confirmation message will appear and with pressing <Ok> we'll be directed to the main raspi-config screen.

➡️ Set up the Localisation

In my case I have my Raspberries in English, and I connect through SSH with a keyboard in English too, so I want to make sure that it is the language and layot set up, and that we won't receive this localization not set up error.

  1. Select 5 Localization Options and then L1 Locale.

  2. A screen with a list of locales to be generated that we need to select. It's a multiselect list, and I had pre-selected en_GB.UTF-8 UTF-8. Select the ones that fit to you. In my case, I prefer the US version for compatibility matters, so I unselect en_GB.UTF-8 UTF-8 and select en_US.UTF-8 UTF-8. Tab to select <Ok> and Press Enter.

  3. A screen will appear asking for the default locale for the system environment. As I mentioned, I want also to get rid of the error message that the locales are not set by default, so here I select the one I wanted to have generated en_US.UTF-8. Tab to select <Ok> and Press Enter. It will proceed to generate the locales and bring us back to the main raspi-config screen.

Now we ensure that we are in the right timezone

  1. Select 5 Localization Options and then L2 Timezone.

  2. A screen to select the geographic area will appear.. In my case I select Europe, Tab to select <Ok> and Press Enter.

  3. A screen to select the Time zone will appear. In my case I select Berlin as I am living in Germany, Tab to select <Ok> and Press Enter. A quick process is done and we're redirected to the main raspi-config screen.

Now we setup the keyboard layout

  1. Select 5 Localization Options and then L3 Keyboard.

  2. A screen to select the keyboard model will appear. In my case I only use the USB keyboard once (actually now) and in case of any issue that requires physical hands on. For the rest I connect via SSH, so any generic that fits in our layout should work. I select Generic 105-key PC (intl.). Just for a note, there is a Macbook/Macbook Pro option, which could fit from what I connect from the 90% of the times, but the Generic one always worked for me whereve I connect from. Tab to select <Ok>and Press Enter.

  3. A screen asking for the Keyboard layout will appear. I mentioned I want English, and I also want to be able to work properly whenever I connect from bia SSH, so I won't select anything too special. I select the basic first one English (US). Tab to select <Ok> and Press Enter.

  4. A screen asking for the behaviour of the AltGr key will appear. One more time,I will connect via SSH so I don't want to settle with one too specific layout. Maybe for you it is interesting to set it up as Right Alt (AltGr) or as the Left Logo key if your keyboard is old and does not have a logo key. I will use the first The default for the keyboard layout. Tab to select <Ok> and Press Enter.

  5. A screen asking for the behaviour of the Compose key will appear. As we connect via SSH, there is No compose key, so we select this option, Tab to select <Ok> and Press Enter. A quick process is done and we're redirected to the main raspi-configscreen.

➡️ Expand Filesystem

Here we make sure that the filesystem is using the 100% of the Micro SD card we have installed. In all my set ups that step was unnecessary, but still it's good to ensure it.

  1. Select 6 Advanced Options and then A1 Expand Filesystem. A quick process will happen and a new screen will appear saying that it's done and will be applied in the next reboot. Pressing Enter will driver us to the main raspi-config screen.

Here I usually take a break and do the reboot. I like to have one set up at a time to ensure that if anything fails I am able to point out what was it, so from the main raspi-config screen we Tab to <Finish> and press Enter. It will ask us to reboot now and we select <Yes> and press Enter. The system will automatically shutdown and start again, and leave us into the login screen, where we introduce the username and password and we'll be in again. Then with sudo raspi-config again we'll be back to the main raspi-config screen.

3. Setting up the network configuration

In the previous article Spawning a Raspberry Pi 4 with Raspberry Pi OS I set up the host to use the dhcpcd network configuration tool, but according to the official documentation at Raspberry Pi Documentation - Configuration / Configuring Networking, the default configuration tool changed:

Network Manager is the default networking configuration tool under Raspberry Pi OS Bookworm or later. While Network Manager can be installed on earlier versions of the operating system using apt and configured as the default using raspi-config, earlier versions used dhcpd and other tools for network configuration by default.

For this reason, I prefer to change my mindset and learn how to use the new default Network Manager so I get less friction from now on.

Therefore, let's achieve the same goal: tell the DNS local server that we have a new machine called jakku with a static IP.

3.1 Set up a static IP with Network Manager

There is a tool that easies the set up of the Network Manager configuration, and that we'll use here: nmtui. It is very similar to the raspi-config but totally focused to the network parameters. The following is a step-by-step walkthrough the process to set up a static IP connection.

  1. Run the configuration tool:

    sudo nmtui
  2. Select Edit a connection. A screen where we can select connections will appear. In my case it only appears Wired connection 1 as I have the ethernet cable connected.

  3. Select the Wired connection 1 connection. A screen with the parameters appear.

  4. Change the Profile name if you want. I won't change it.

  5. Move down to select IPv4 CONFIGURATION and press Enter. A popup will appear where you can select from Disabled which means no connection, Automatic which is currently selected and means to use the received parameters from the DHCP server, Link-Local, Manual and Shared.

  6. Move down to select Manual and press Enter.

  7. Move right to select <Show> and press Enter. The IPv4 section will expand to show the parameters that we can set up for the connection.

  8. Move down and type the parameters that fit to your network set up. In my case I introduced the following:

    1. Addresses: 192.168.1.239

    2. Gateway: 192.168.1.1

    3. DNS servers: 192.168.1.231

    4. Search domains: local

    Just a note here: Why local? Beyond what the wikipedia explains, this will be used to build a FQDN for the machine name we have. So in our case, this will be jakku.local. This should be tied to the "domain" we're using in this network, which is private and local, and actually defined by us in case we're running a local DNS server, as is my case. In a previos article Quick DNS server on a Raspberry Pi, I note that I set up domain=local and therefore here I will use the same so that this static configuration matches with the automatic I set up in general for my network.

  9. Move down to <OK> and press Enter. We're back into the connection selector.

  10. Move down to <Back> and press Enter. We're back to the main menu.

  11. Move down to Set system hostname and press Enter. A pop up appears to change our hostname. It should already appear jakku.

  12. Change if we feel so, and move down to select <Ok> and press Enter

  13. Move up to select Activate a connection. A screen with the available connections appear, having our Wired connection 1 a star * character in front telling us that it is already active. It also appears the possible WiFi connection, but we don't want it to be active (by now).

  14. With the Wired connection 1 selected, press Enter to deactivate it and then press Enter again to re-activate it. Now the changes we did should be applied.

  15. Move down to <Back> and press Enter. We're back to the main menu.

  16. Move down to <Ok> and press Enter.

  17. Now that we're back into the shell, let's see if the configuration was successfully applied:

    ifconfig

    We should see 3 network interfaces: end0 with the configuration that we set up above, lo which is the loopback, and wlan0 that we kept deactivated.

At this point we should have the network set up. What I like to do is to ensure that it works after a reboot, so I just trigger it by:

reboot

When the machine is back online, I issue again the ifconfig and see that the configuration stays.

And one more check, I go to my laptop and try to ping into the machine:

ping 192.168.1.239

... and the new host answers.

3.2. Add the host to the local DNS server

This is surely optional for you. I have a local DNS server and I want to use hostnames and not IPs while working around.

So, from any computer of my local network,

  1. SSH into the DNS server:

    ssh xavi@dagobah
  2. Edit the hosts configuration file:

    sudo nano /etc/hosts
  3. Add a new entry for the new host:

    192.168.1.239 jakku
  4. Save (ctrl + o) and exit (ctrl + x)

  5. Restart the DNS server:

    sudo /etc/init.d/dnsmasq restart

Now, coming back to the terminal of any computer of the network, we can test that the DNS entry is working properly by pinging to jakku:

ping jakku

... and jakku should answer.

ℹ️ Note: From here on, we should be able to do everything else remotely via SSH even using the local DNS server. It's up to you if you continue the configuration physically as we have the keyboard and the screen connected, or if you prefer to do everything else remotely via SSH.

4. Activate the basics in the .bashrc file

So here we just enable some of the things that for me are basic when behaving with the Raspberry Pi:

  1. SSH into jakku:

    ssh xavi@jakku
  2. Edit the .bashrc file:

    nano ~/.bashrc
  3. Uncoment the alias lines, so they appear like:

    alias ll='ls -l'
    alias la='ls -A'
    alias l='ls -CF'
  4. Save (ctrl + o) and exit (ctrl + x)

  5. Reload the .bashrc file:

    source ~/.bashrc

5. Setting up the Keys pair

I do connect often via SSH from my laptop to my Raspberries, so a very convenient thing for me is to set up the SSH key authentication between my laptop and this new Raspberry Pi, so that the Raspberry accepts the key from the laptop and does not asks the password every time.

I won't extend too much here, as I have already a nice article explaining exactly this topic:

📄 Set up the SSH Key authentication between hosts

5.1. Get the laptop's public key

By the article above, I assume that we have already generated the key pair in our laptop. So the only thing we need to do here is to copy its public key:

  1. Show the key. In our case is a ED25519:

    cat ~/.ssh/id_ed25519.pub
  2. It will show a text string. Copy all of it.

5.2. Add the laptop's public key into the Raspberry Pi

At this point, even we activated the SSH server in our Raspberry Pi, it lacks all the host / user configuration like keys and so on. We could skip this process and just add the file that is read when a host wants to connect to it, but I know in the future I would like to have the keys generated, so there we go.

  1. SSH into jakku from the laptop:

    ssh xavi@jakku
  2. Generate the new pair of ED25519 keys for this host (as explained in the linked article above):

    ssh-keygen -t ed25519

This also creates the directory where all the host / user configuration is placed, so at this point we should be able to add the laptop's public key in the required file.

  1. Create and edit a file for the incoming authorised connection keys:

    sudo nano ~/.ssh/authorized_keys
  2. Paste here the public key line we copied from the laptop.

  3. Save (ctrl + o) and exit (ctrl + x).

  4. Disconnect from this SSH connection (ctrl + d)

  5. SSH into jakku again to test that we don't need the password.

  6. Should work!

6. Wrapping up

As we saw in the previous iteration Spawning a Raspberry Pi 4 with Raspberry Pi OS, the process is very straight forward and from Bullseye to Bookworm did not change too much, only the way we set up the network and the static IP.

Hopefully this article brings the same common base for new and exciting Raspberry Pi projects like the previous article did for me. 🚀

Previous Post Next Post