Headless Ubuntu Server on Raspberry Pi

Raspberry Pi is an awesome single board computer. People have made all sorts of cool things using these versatile and compact packages. And if you are one of those people you might have started your journey with Raspberry Pi OS ( or Raspbian if you prefer the old name) which is the default recommendation and frankly, it is great! Optimised to run on a Pi be it any version from zero to four. But there are tons of OS options to try out there, and Ubuntu Server is my favourite among them!

In this article we will explore how to install Ubuntu Server on your Raspberry Pi. Ubuntu server is a good choice if you want to use your Pi as a server, a headless system taking care of the good stuff in the background. You might also want to save some resources by giving the GUI a skip so that the important stuff has more juice to run on. We will go by an headless installation, i.e no need to connect your Pi to a Keyboard-Mouse-Display, instead we will use SSH from our desktop to talk to Pi.

I have tested this method on Raspberry Pi 4 and with Ubuntu Server 20.04 LTS. I think it will work for other combinations as well. I am using a Linux based desktop (Pop_OS! 20.04) so if you want to try this from windows you will have to make some adjustments. So let us begin!

Pop the micro SD card into your PC. And install Raspberry Pi Imager from the repository using the following command.

sudo apt update
sudo apt install snapd
sudo snap install rpi-imager

Launch Raspberry Pi Imager and you will see something like this

Click on ‘CHOOSE OS’ button and select the Ubuntu Server version you want to install, I chose the 32 bit LTS version.

Now we will select the SD card to which we want to write the image to, please check and double check to make sure that you have chosen the right one otherwise you will loose your data. Then click on ‘WRITE’ and confirm your choice.

This will write the image to the SD card, once it is finished you will be prompted to remove the card, but don’t do it yet! We will need to configure WiFi for our headless setup.

Go to the newly created ‘system-boot’ partition and open up a terminal in it. Use your favourite editor to do the next step, I have used gedit.

sudo gedit network-config

This will open up a network configuration file, edit it with your WiFi SSID and password as shown below, and be careful with the indents.

Save the file, safely remove the SD card and pop it into your Pi, and then power it on. Your Pi should be able to connect to the WiFi you have provided in the previous step. Make sure that you are connected to the same network as well. To SSH into your Pi we need its IP Address. Check your desktop’s IP address using the following commands on a terminal.


Use the first three segments of your IP address and use the following command on the terminal to find the IP address of your Raspberry Pi.

sudo apt install nmap
sudo nmap -sP

Now that we know the IP address we can SSH into Pi using the following commands.

ssh ubuntu@

When it prompts for confirmation type ‘yes’ and then when asked the password of the host, type ‘ubuntu’ which is the default , you will be prompted to change your password on the first login. Then the connection will close automatically, restart ssh using the new password.

Yay! We can now use Pi from our desktop! You can also install your favourite desktop environment if you need a GUI. But the main purpose of this exercise is to obtain a bare bones system on which we can do our heavy stuff. So what are you waiting for? Go Pi your heart out!

I hope you enjoyed this post, see you in the next one!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: