The Raspberry Pi is the best-known single-board computer. Initially, the scope of the Raspberry Pi project was targeted to the promotion of teaching of basic computer science in schools and in developing countries.

Its low cost, portability and very low power consumption, made the models far more popular than anticipated. From weather station to home automation, tinkerers built so many cool projects using Raspberry Pi.

The 4th generation of the Raspberry Pi, is equipped with features and processing power of a regular desktop computer. But this article is not about using RPi as desktop. Instead, I’ll show you how to install Ubuntu server on Raspberry Pi.

In this tutorial I will use a Raspberry Pi 4 and I will cover the following:

  • Installing Ubuntu Server on a microSD card
  • Setting up a wireless network connection on the Raspberry Pi
  • Accessing your Raspberry Pi via SSH
Ubuntu server on Raspberry Pi

You’ll need the following things for this tutorial:

  • A micro SD card (8 GB or greater recommended)
  • A computer (running Linux, Windows or macOS) with a micro SD card reader
  • A Raspberry Pi 2, 3 or 4
  • Good internet connection
  • An HDMI cable for the Pi 2 & 3 and a micro HDMI cable for the Pi 4 (optional)
  • A USB keyboard set (optional)

Installing Ubuntu Server on a Raspberry Pi

Ubuntu Server Raspberry Pi

I have used Ubuntu for creating Raspberry Pi SD card in this tutorial but you may follow it on other Linux distributions, macOS and Windows as well. This is because the steps for preparing the SD card is the same with Raspberry Pi Imager tool.

The Raspberry Pi Imager tool downloads the image of your choice of Raspberry Pi OS automatically. This means that you need a good internet connection for downloading data around 1 GB.

Step 1: Prepare the SD Card with Raspberry Pi Imager

Make sure you have inserted the microSD card into your computer, and install the Raspberry Pi Imager at your computer.

You can download the Imager tool for your operating system from these links:

Despite I use Ubuntu, I won’t use the Debian package that is listed above, but I will install the snap package using the command line. This method can be applied to wider range of Linux distributions.

sudo snap install rpi-imager

Once you have installed Raspberry Pi Imager tool, find and open it and click on the “CHOOSE OS” menu.

Raspberry Pi Imager

Scroll across the menu and click on “Ubuntu” (Core and Server Images).

Raspberry Pi Imager Choose Ubuntu

From the available images, I choose the Ubuntu 20.04 LTS 64 bit. If you have a Raspberry Pi 2, you are limited to the 32bit image.

Important Note: If you use the latest Raspberry Pi 4 – 8 GB RAM model, you should choose the 64bit OS, otherwise you will be able to use 4 GB RAM only.

Raspberry Pi Imager Ubuntu Server

Select your microSD card from the “SD Card” menu, and click on “WRITE”after.

Raspberry Pi Imager Sd Card

If it shows some error, try writing it again. It will now download the Ubuntu server image and write it to the micro SD card.

It will notify you when the process is completed.

Ubuntu Server Installed Raspberry Pi

Step 2: Add WiFi support to Ubuntu server

Once the micro SD card flashing is done, you are almost ready to use it. There is one thng that you may want to do before using it and that is to add Wi-Fi support. If you don’t do it right now, you’ll have to put extra effort later in connecting to wifi from terminal in Ubuntu server.

With the SD card still inserted in the card reader, open the file manager and locate the “system-boot” partition on the card.

The file that you are looking for and need to edit is named network-config.

Ubuntu Server Pi Network Config

This process can be done on Windows and MacOS too. Edit the network-config file as already mentioned to add your Wi-Fi credentials.

Firstly, uncomment (remove the hashtag “#” at the beginning) from lines that are included in the rectangular box.

After that, replace myhomewifi with your Wi-Fi network name enclosed in quotation marks, such as “itsfoss” and the “S3kr1t” with the Wi-Fi password enclosed in quotation marks, such as “12345679”.

Ubuntu Server on Raspberry Pi WiFi setup

It may look like this:

wifis: wlan0: dhcp4: true optional: true access-points: "your wifi name": password: "your_wifi_password"

Save the file and insert the micro SD card into your Raspberry Pi. During the first boot, if your Raspberry Pi fails connect to the Wi-Fi network, simply reboot your device.

Step 3: Use Ubuntu server on Raspberry Pi (if you have dedicated monitor, keyboard and mouse for Raspberry Pi)

If you have got an additional set of mouse, keyboard and a monitor for the Raspberry Pi, you can use easily use it like any other computer (but without GUI).

Simply insert the micro SD card to the Raspberry Pi, plug in the monitor, keyboard and mouse. Now turn on your Raspberry Pi. It will present TTY login screen (black terminal screen) and aks for username and password.

  • Default username: ubuntu
  • Default password: ubuntu

When prompted, use “ubuntu” for the password. Right after a successful login, Ubuntu will ask you to change the default password.

Enjoy your Ubuntu Server!

Step 3: Connect remotely to your Raspberry Pi via SSH (if you don’t have monitor, keyboard and mouse for Raspberry Pi)

It is okay if you don’t have a dedicated monitor to be used with Raspberry Pi. Who needs a monitor with a server when you can just SSH into it and use it the way you want?

On Ubuntu and Mac OS, an SSH client is usually already installed. To connect remotely to your Raspberry Pi, you need to discover its IP address. Check the devices connected to your network and see which one is the Raspberry Pi.

Since I don’t have access to a Windows machine, you can access a comprehensive guide provided by Microsoft.

Open a terminal and run the following command:

ssh [email protected]_pi_ip_address

You will be asked to confirm the connection with the message:

Are you sure you want to continue connecting (yes/no/[fingerprint])?

Type “yes” and click the enter key.

Connecting to Ubuntu server running on Raspberry Pi via SSH

When prompted, use “ubuntu” for the password as mentioned earlier. You’ll be asked to change the password of course.

Once done, you will be automatically logged out and you have to reconnect, using your new password.

Your Ubuntu server is up and running on a Raspberry Pi!

Conclusion

Installing Ubuntu Server on a Raspberry Pi is an easy process and it comes pre-configured at a great degree which the use a pleasant experience.

I have to say that among all the operating systems that I tried on my Raspberry Pi, Ubuntu Server was the easiest to install. I am not exaggerating. Check my guide on installing Arch Linux on Raspberry Pi for reference.

I hope this guide helped you in installing Ubuntu server on your Raspberry Pi as well. If you have questions or suggestions, please let me know in the comment section.

Similar Posts