Cybersecurity Updates & Tools

Install Ubuntu on Raspberry Pi: Flash, Configure, and Boot

Raspberry Pi is the most popular single-board computer ever made. It is small, affordable, and surprisingly capable. People use it as:

  • A lightweight desktop or home server
  • A home media center or smart router
  • A game server or retro gaming system
  • A home automation controller

You can run many operating systems on it, including Raspbian, Arch Linux, FreeBSD, and Ubuntu. This guide shows you how to install Ubuntu on a Raspberry Pi using the Raspberry Pi Imager tool, configure Wi-Fi before the first boot, and log in over SSH.

Flash Ubuntu to Your SD Card

The easiest way to get Ubuntu onto an SD card is with Raspberry Pi Imager. It is a free, open-source tool available for Windows, macOS, and Ubuntu. Download it from the Raspberry Pi downloads page.

<strong>Important:</strong>&nbsp;Flashing an image erases everything on the SD card. Back up any data on it before you continue.

Insert your SD card into your computer’s card reader. Launch Raspberry Pi Imager and follow these steps:

  1. Click CHOOSE OS and scroll down to select Ubuntu
  2. Choose the Ubuntu image that matches your Pi model. For a Raspberry Pi 4 with 4 GB RAM, pick Ubuntu 20.04 64-bit
  3. Click CHOOSE SD CARD and select your card from the list. If more than one card is connected, double-check you picked the right one
  4. Click WRITE to start downloading and flashing the image

The process takes a few minutes depending on your connection speed and card speed. When it finishes, the app shows a success message.

Configure Wi-Fi Before First Boot

If you plan to connect your Raspberry Pi with an Ethernet cable, plug it into your router and skip this section.

For a wireless connection, you need to add your Wi-Fi details to the SD card before booting.

After flashing, the SD card has a partition called system-boot. Open it with your file manager. Find the file named network-config and edit it with your network name and password:

yamlversion: 2ethernets:  eth0:    dhcp4: true    optional: truewifis:  wlan0:    dhcp4: true    optional: true    access-points:      my-router:        password: "S3kr1t"

Replace my-router with your Wi-Fi network name and S3kr1t with your password. Save the file and eject the SD card.

On first boot, the Pi will connect to your network automatically.

Boot and Log In to Ubuntu on Raspberry Pi

Insert the SD card into your Pi. If you are using a monitor and keyboard, connect them before plugging in the power cable. Then power on the board.

The first boot takes a few minutes. Once the Pi is online, find its IP address in your router’s DHCP lease table. Then connect over SSH:

bashssh ubuntu@192.168.1.149

The default username and password are both ubuntu.

The first time you log in, Ubuntu prompts you to change the default password. Set a strong, unique password and you are in.

<strong>Tip:</strong>&nbsp;If you plan to run your Pi headless (no monitor or keyboard), SSH is all you need. You can manage everything from your main computer's terminal from that point on.

Ubuntu is now running on your Raspberry Pi. From here, update the system with sudo apt update && sudo apt upgrade, install the software you need, and set it up for whatever you want to use it for. Got questions? Leave a comment below.