Pirobits
  

Install Ubuntu Server on your Raspberry Pi

alberto avatar
homelab
Alberto Sola · 5/5/2024 · 7 min

Learn how to install and configure Ubuntu Server on your Raspberry Pi to build a homelab, deploy your projects or just learn. I tell you everything you need and a step by step.

Several years ago I had a small homelab at home that I had to abandon, and now it's time to take it up again. To do this I will start configuring a Raspberry Pi 4 (Model B) with 8GB of RAM that I had at home, and then improve the homelab adding some very interesting projects. Remember to subscribe to the newsletter so you don't miss them.

An important issue of the homelab is the network topology (router, access points, cabling...). On the one hand I am happy with the current elements, but on the other hand there is still a lot of room for improvement. I will leave this topic of networking for another post / video.

*My goal with this post is to configure a Raspberry Pi as a server, we will install an operating system and connect directly to the Raspberry Pi using an SSH connection to manage it * I will choose Ubuntu Server as it is the operating system that I like to work with the most, but you can choose any other really.

What I love about this kind of devices is how something so simple, small, with low power consumption, has so much potential for all kinds of applications. I would like to take advantage of both pirobits to tell you about the current status and the improvements I will be working on for my homelab.

Why a Raspberry Pi

The rapsberry pi is a "low cost" computer, which has a compact size (fits in the palm of a hand) and you can use it for all kinds of tasks: it can be a computer because it allows you to have multiple monitors via HDMI, you can do all kinds of automation or home automation projects, or you can set up a server for your homelab and experiment with thousands of ideas.

I personally have always loved it and I want to tell you about it in this blog. Specifically the 4B model, which stands out for being more powerful, includes wifi and bluetooth, and also gigabit ethernet connection. Recently the model 5 has been released, and I have my eye on it. If the homelab project continues to grow, we may expand the Raspberry Pis family. I also have the first model, although it requires some repair with soldering. In my case I also have some old computer, so if you don't have a raspberry, you can use any computer you have in disuse.

Besides, they are perfect for experimenting and learning. If you make a mistake and "break" the operating system, don't worry because you can simply start over by repeating the installation process.

Materials needed

For today's project we will need the following devices:

  • Raspberry Pi, almost any model you have is valid.
  • A micro-SD card. I recommend you to buy a quality micro-sd card, so that the operating system runs fast. They are divided into classes, and the recommended is a U3 or U1. I have a 32GB from several years ago, today you can probably buy one of higher capacity for the same price.
  • A power adapter** to power the board.
  • A network cable. As we have gigabit connection, it should be a good cable, for example category 6.
  • An adapter** to connect the micro-sd card to the computer.
  • Optional. A case for the Raspberry Pi along with some heat dissipation.

The raspberry pi 4 has Wi-Fi and you can configure the operating system to use it, but in my case I prefer to use the network cable to make the connection more robust. Also one of the advantages is that the model 4 has gigabit ethernet as we discussed earlier, so the speed should be noticeable.

Since I am going to use it as a server, I will not use an HDMI to Micro-HDMI cable, which is necessary if you want to use a monitor as well as a keyboard. In this tutorial we will configure the raspberry pi remotely and connect directly via SSH.

Tutorial: Installing Ubuntu Server

Make sure that the micro-sd card does not have any data on it before proceeding, as formatting the card will result in the loss of any data on it.

The first step is to connect the micro-sd card to the adapter and to your computer, so that you can install the operating system. To do this we will use the tool Raspberry Pi Imager that simplifies this whole process.

I remember several years ago where this whole process was much more manual. I see that the ecosystem is improving and I like it.

We download the program, install it and when we run it we select four options:

  • Device. Choose your Raspberry Pi model, in my case it is the model 4.
  • Operating system**. Choose your preferred operating system. In my case it is Ubuntu Server 24 x64.
  • Storage**. Choose the storage device associated with the micro-sd card that you have connected to your pc.

Click on the "Next" button and you will get a window to customize the installation settings. Here we will configure the parameters:

  • We change the user / password of the operating system for the one you prefer. For example: pirobits / change me.
  • Enable SSH connectivity and check the password login checkbox. This is not the most secure option, but it allows us to configure it easily and then we can configure it to our liking.
  • It also gives the option to configure a WIFI network. In my case I am going to connect the Raspberry Pi via cable so I am not going to use it, but if you are experimenting, maybe it is easier for you.

Save and wait for the operating system to finish writing to the micro-sd card. We remove the micro-sd card from the adapter and connect it to the raspberry-pi. We mount the case, connect the network cable, the power adapter. Connect the raspberry pi to the router, turn it on and that's it! It will take a few minutes to set up.

In the meantime, let's find out what is the IP of the raspberry pi. Let's go back to our computer to access it via SSH.

SSH connection

Already on our computer, what we have to do is to find out what is the IP of the raspberry pi. To do this we connect to the router and look at the list of devices to find the internal IP of our raspberry pi. This step will change depending on the router you have. If you have a mesh system you may be able to see it from the app.

This IP may change if your system uses dynamic DHCP. In my case the router allows me to assign a static IP to the devices by MAC, so I set the IP of the raspberry pi.

Once the IP is located, open a terminal and run the following command, changing the user and IP for your corresponding data:

ssh [email protected]

It will ask us for the password, we type the one we have previously configured and that's it, we are now connected inside our raspberry pi.

When I boot an operating system, I always like to run the following two commands:

sudo apt update
sudo apt upgrade

You already have a raspberry pi, configured with ubuntu server and ssh connection to perform all kinds of experiments. Now you can install and configure the software you prefer to learn, for your homelab or just for fun.

Remember that the default configuration is not the most secure for a production server, so some adjustments should be made. Also remember to follow me so I can let you know about new projects and homelab updates to come. greetings!

Did you find this article useful? Subscribe to my newsletter and take the first step to launch IT products faster. You will receive exclusive tips that will bring you closer to your goals.


Recent posts