How to install Ubuntu on your Raspberry Pi


Duration: 2:00

In this tutorial, we walk you through the process of installing Ubuntu Server on a Raspberry Pi, connecting it to the internet and using it remotely. There are two setup methods in this tutorial: with an extra HDMI screen and USB keyboard for your Pi, or headless. Let’s start!

What you’ll learn

  • How to create a bootable Ubuntu Server microSD card
  • How to setup internet connectivity on the Raspberry Pi
  • How to access your Raspberry Pi remotely

What you’ll need

  • A microSD card (4GB minimum, 8GB recommended)
  • A computer with a microSD card drive
  • A Raspberry Pi 2, 3 or 4
  • A micro-USB power cable (USB-C for the Pi 4)
  • A Wi-Fi network or an ethernet cable with an internet connection

And optionally:

  • A monitor with an HDMI interface
  • An HDMI cable for the Pi 2 & 3 and a micro HDMI cable for the Pi 4
  • A USB keyboard

Prepare the SD Card

Duration: 5:00

:warning: Warning
Following these steps will erase all existing content on the microSD card.

First, insert the microSD card into your computer.

Now you need to install the right Raspberry Pi Imager for your operating system. You can do this with the following links:

Once this is done, start the Imager and open the “CHOOSE OS” menu.

Scroll down the menu click “Ubuntu”.

You will then be able to see a list of Ubuntu downloads to choose from. For this tutorial we recommend you select the Ubuntu 20.04 download. As indicated in the imager this will work for the Raspberry Pi 2,3, 3+ and any of the 4’s.

Select the image and open the “SD Card” menu. Select the microSD card you have inserted.

Finally, click “WRITE” and wait for the magic to happen… (This magic might take a few minutes)

Wi-Fi or Ethernet

Duration: 5:00

There are two ways to get your Pi connected to the internet:

  • The first is to connect your Pi to your router with an ethernet cable. In this case, you can skip this step and go to the next one in the tutorial.
  • The second requires a local Wi-Fi network that both your computer and Pi can be connected to. We are going to edit files you just downloaded on your SD card to ensure your Pi can connect to the Wi-Fi network at boot.

Getting setup with Wi-Fi

With the SD card still inserted in your laptop, open a file manager and locate the “system-boot” partition on the card. It contains initial configuration files that will be loaded during the first boot.

Note: Screenshots have been made on an Ubuntu desktop but it can be done on Windows and MacOS too

Edit the network-config file to add your Wi-Fi credentials. An example is already included in the file, you can simply adapt it.

To do so, uncomment (remove the “#” at the beginning) and edit the following lines:

  dhcp4: true
  optional: true
    <wifi network name>:
      password: "<wifi password>"

For example:

  dhcp4: true
  optional: true
    "home network":
      password: "123456789"

Note: network name must be enclosed in quotation marks.

Save the file and extract the card from your laptop.

Note: During the first boot, your Raspberry Pi will try to connect to this network. It will fail the first time around. Simply reboot sudo reboot and it will work.

Boot Ubuntu Server

Duration: 2:00

If you are using an HDMI screen and a USB keyboard, ensure they are plugged in before powering the Pi. You will be able to see the boot process on screen and log in using “ubuntu” as both the password and login ID.

If you are running your device headless, you need to connect to it remotely from your laptop. We are going to do so using the SSH protocol.

Insert the SD card into the Pi and power it up (plug in your power supply). After a minute or so, Ubuntu on your Raspberry Pi will have fully booted and connected to the network.

Connect remotely to your Raspberry Pi

To connect to your Raspberry Pi remotely, you need two things (we’ll help you find them):

  • Its IP address on the local network
  • An SSH client (SSH is a communication protocol between machines)

Determining the Pi’s IP address

To determine the IP address of your board, open a terminal and run the arp command:

On Ubuntu and Mac OS:

arp -na | grep -i "b8:27:eb"

If this doesn’t work and you are using the latest Raspberry Pi 4, instead run:

arp -na | grep -i "dc:a6:32"

Depending on your version of Ubuntu, you may need to install the net-tools package. Install it with sudo apt install net-tools and try the arp command again.

On Windows:

arp -a | findstr b8-27-eb

If this doesn’t work and you are using the latest Raspberry Pi 4, instead run:

arp -a | findstr dc-a6-32

This will return an output similar to:

 ? (xx.xx.xx.x) at b8:27:eb:yy:yy:yy [ether] on wlp2s0

Where the x’s are the IP address of any Raspberry Pi connected to the local network. Note it down.

If the command doesn’t return an IP address, you may need to wait a little longer for your Pi to join the network. If you still can’t see it after a few tries, which can happen with some home or office network configurations, we recommend you use a USB keyboard and HDMI screen to interact with your device.

Using an SSH client

On Ubuntu and Mac OS, an SSH client is already installed. Some versions of Windows 10 also include an SSH client too, but if yours does not or you’re unsure, follow these steps to install one.

Open a terminal and run the following command:

ssh ubuntu@<Raspberry Pi’s IP address>

You will be asked to confirm the connection:

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

Type “yes” to confirm.

Changing the password

When prompted, use “ubuntu” for the password. (The cursor won’t move when you type the password.) The first thing Ubuntu will do is to ask you to change it to a secure password. Once done, you can reconnect again with the SSH command and the new password.

Success! You are now connected to Ubuntu Server running on your Raspberry Pi.

Install a desktop

Duration: 10:00

Optional step
Depending on what you are going to use your Pi for, you may want a desktop environment to run graphical applications. Nevertheless, this step is completely optional.

First you need to ensure your packages are updated to the latest version, run:

sudo apt update
sudo apt upgrade

Then, you can use the apt install command to install a desktop environment.

Here are some popular and lightweight options:

sudo apt install xubuntu-desktop

sudo apt install lubuntu-desktop

If you run into issues with either of these check out this blog. We’re working on fixing this imminently.

Learn more about Ubuntu flavours.

Once the install finishes, reboot your pi with:

sudo reboot

And your new desktop will come up automatically

That’s all folks!

You are done! Up and running on Ubuntu Server.

For more details about Raspberry Pi specific packages included with this image and further customisations, such as accelerated video drivers and optional package repositories, you can refer to the RaspberryPi wiki.

You also might want to install some software on your Pi. Ubuntu has extensive repositories available, that you can browse at You can also use the snap command to install snap packages. The Snap Store is where you can find the best Linux open source and proprietary apps to install on your Raspberry Pi and get started with any project!

I recommend adding a step to this tutorial to have users run:

sudo apt-get update
sudo apt-get upgrade

prior to attempting to install a desktop. When I first tried to load a desktop, the install failed, but it did suggest running those two commands. I did so, then re-ran the installation of the desktop, and it worked.

Very good point, thanks for catching this, I’ve updated the tuto.

1 Like

I have been trying to install Ubuntu Server 18.04 on my Raspberry Pi. I am ok until until I get to booting the Ubuntu server. The boot up process asks for a login and password. The tutorial mentions using ubuntu as password, but what do I use for a login ID?

Hi kvemuri, you can use ubuntu for both the login ID and the password. That’s a good catch though thank you. I have now included that in the tutorial :slight_smile:

1 Like

Hi Rhys-Davies,

under getting “setup with wi-fi”, I do not have a file entitled network-config within the system boot partition on the SD card.

Far more to the point, however, how may I install Ubuntu server on my Raspberry Pi with a static IP?

Hi colossal,

If you don’t have the file you might be using the wrong image or be looking in the wrong place. I’d advise going through the process again, and make selections with extra care. If the problem still persists let us know, I believe a static/dynamic IP is router specific, so the install process should be the same.

Some versions of Windows 10 include an SSH client accessible through the Command Prompt.

1 Like

Thanks for letting us know Phil, I’ve made the edit :slight_smile:

There’s typo in the above part:
“Rapsberry” -> “Raspberry”

Heck, that one’s embarrassing, thanks for catching it :slight_smile:

Was there a change of login and password ?
I followed all the instructions (ethernet cable set) once I power my raspberry, after 1 minute I get “ubuntu login”.
I enter “ubuntu” as login
Then I get “password”
I can’t write anything, doesn’t work
I press enter and I get :
ubuntu login incorrect
ubuntu login :

I am very sorry to annoy you but I haven’t found any answer on forums.
I am stuck with this situation, can’t write anything without being asked for the ubuntu login and its password.
Thank you for your help.

I couldn’t find the user name and password for the new server install.
i found it on the web
but would be nice to have it here.
for the rest the install and instructions are great

Hi presistent-cc, first let me say this is not annoying at all, this is exactly what this forum is for, I’m sorry for taking so long to get back to you.

To your question, this is a known issue. The login and password is still ‘ubuntu’ for both. However when you are asked for those credentials there is still some code running in the background. Until its finished you won’t be able to log in. Unfortunately there isn’t a fix for this yet, although we are working on it. Fortunately, if you wait a few more minutes, the process will finish running and you will be able to log in. Sorry for the inconvenience, as I say, we know about it and are working on it. Once you wait it out this first time though every subsequent time you will be bale to login without the wait.

1 Like

Hi wisdomlight, thanks for your comment, although I’m not sure I understand what you mean. The user name (here noted as login ID) and password are both listed here, they are ‘ubuntu’ for both.

yes but somehow they weren’t that clear.
i think it would have been easier to have them somewhere earlier.
maybe it is a redundant point.

also after doing passwordless ssh i went on and i installed kubuntu. Then the machine did not boot. It started the boot process I could see many things happening all with green ok and then there where three lines and the 4th was a prompt and nothing happened. strange.

So I re wrote the SD card today and ubuntu with ubuntu did not work!

I am going to re try.
then I re installed the ubuntu server

1 Like

Again the same problem occurred with installing kubuntu in Rpi 4 that had a successful installation of Ubuntu 20


You might want to add dc:a6:32 too when looking for IP address via arp.

Hello, Thank you for your reply. I tried again and waited 15 minutes. It didn’t solve the problem. I can’t write anything when I get to the step “password”. I send you screenshot enclosed. (I used a Raspberry pi 3B brand new, a 64Gb SD card and Ethernet cable).

Thank you for your help.

Having the same exact problem here. Would love to understand what exactly it is I have to do to get it working.

Same thing: Followed Ubuntu’s tutorial for RPi4 and Ubuntu 20 installed successfully. So I typed sudo reboot and waited for awhile and it got here and just hung. Forever. I have no idea what to do now.