Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Install Ubuntu on Raspberry Pi: Step-by-Step

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

You can install Ubuntu on a Raspberry Pi by flashing the official Ubuntu Server or Desktop image to a microSD card, then booting the Pi from that card. This guide walks you through the entire process, from downloading the right image to first boot, with troubleshooting for common issues.

What You'll Need

  • A Raspberry Pi (model 2, 3, 4, 5, or 400; check Ubuntu's supported list for your exact model)
  • A microSD card (at least 16 GB for Desktop, 8 GB for Server; Class 10 or faster recommended)
  • A computer with an SD card reader (Windows, macOS, or Linux)
  • Software to flash the image: Raspberry Pi Imager (recommended) or balenaEtcher
  • A monitor, HDMI cable, keyboard, and mouse (for Desktop or first-time setup)
  • Power supply (official Raspberry Pi power adapter recommended)
  • Ethernet cable or Wi-Fi (for network setup during install)

Step-by-Step

  1. Download the Ubuntu image. Go to ubuntu.com/download/raspberry-pi and choose either Ubuntu Server or Ubuntu Desktop. Server is lighter and headless; Desktop gives you a full GUI. Select the version that matches your Pi model (e.g., 24.04 LTS for Pi 4/5). Download the .img.xz file.
  2. Install Raspberry Pi Imager. If you don't have it, download and install Raspberry Pi Imager from the official Raspberry Pi website (raspberrypi.com/software). It works on Windows, macOS, and Linux.
  3. Insert the microSD card into your computer's card reader. Note the drive letter (Windows) or mount point (macOS/Linux).
  4. Open Raspberry Pi Imager. Click "Choose OS" and scroll down to "Other general-purpose OS" > "Ubuntu" and select the version you downloaded. If you downloaded a separate .img.xz file, choose "Use custom" and browse to that file.
  5. Choose the SD card. Click "Choose Storage" and select your microSD card. Double-check you have the right device—this will erase everything on it.
  6. Flash the image. Click "Write" (or "Flash"). Confirm the warning that all data on the card will be erased. Wait for the process to finish—it can take several minutes. Do not remove the card during writing.
  7. Eject the card safely from your computer.
  8. Insert the card into the Raspberry Pi. Make sure the Pi is powered off. Insert the microSD card into the slot on the underside of the Pi.
  9. Connect peripherals. Plug in a monitor via HDMI, a USB keyboard and mouse, and an Ethernet cable if you're not using Wi-Fi.
  10. Power up the Pi. Connect the USB-C (Pi 4/5) or micro-USB (Pi 2/3) power supply. The Pi will boot from the SD card. The first boot may take a few minutes.
  11. Complete the initial setup. For Server, you'll see a login prompt. Default credentials are username ubuntu and password ubuntu. You'll be forced to change the password on first login. For Desktop, follow the on-screen setup wizard: choose language, connect to Wi-Fi, create a user account, and set a password.
  12. Update the system. Once logged in, open a terminal (Ctrl+Alt+T on Desktop) and run sudo apt update && sudo apt upgrade to install the latest security patches and software updates. Reboot if prompted.

Common Mistakes

  • Using the wrong image for your Pi model. Ubuntu images are model-specific. For example, an image for Raspberry Pi 4 may not boot on Pi 5. Always download the image labeled for your exact model.
  • Not erasing the SD card first. If the card has an existing OS, the flash may fail or leave corrupted data. Use Imager's "Erase" option (via the storage menu) before writing if you encounter issues.
  • Removing the card during flashing. Interrupting the write process corrupts the card. Wait for the "Write Successful" message.
  • Forgetting to change the default password. Leaving the default ubuntu password is a security risk. Change it immediately.
  • Using a low-quality or undersized SD card. Cards below 8 GB or slow cards cause boot failures and freezes. Use a reputable brand with at least 16 GB.

Tips

  • Use a wired Ethernet connection for the first boot—it's more reliable than Wi-Fi for downloading updates.
  • If you're installing Server, consider setting up SSH before first boot. You can do this by mounting the SD card after flashing (on your computer) and creating an empty file named ssh in the boot partition. This enables SSH so you can log in remotely.
  • Back up your SD card after a successful setup. Use dd on Linux or a tool like Win32DiskImager on Windows to create an image of the card—this saves you from redoing the install if the card fails.
  • For headless Server setups, you can pre-configure Wi-Fi by editing the network-config file in the boot partition before first boot. The file contains commented examples.
  • Keep the Pi well-ventilated. Ubuntu Desktop can generate heat; a heatsink or fan helps prevent thermal throttling.

Troubleshooting

  • Pi won't boot (no display, no activity LED). First, check the power supply—it must provide at least 5V/2.5A (Pi 4/5 need 3A). Try a different cable. If the LED is on but no display, re-flash the SD card, ensuring you used the correct image for your Pi model.
  • Boot loops or crashes during first boot. This often indicates a corrupted image or incompatible SD card. Re-flash the card, or try a different card. Also, check that the card is fully inserted.
  • Login prompt appears but password "ubuntu" doesn't work. The default password only works if you haven't set a custom one. If you've already logged in before and changed it, use that new password. If you never changed it and it fails, re-flash the card and start over.
  • Wi-Fi doesn't connect on Desktop. Go to Settings > Wi-Fi and ensure the adapter is enabled. If it's not showing, run sudo apt update && sudo apt upgrade and reboot—drivers may need updating.
  • Screen resolution is wrong or no HDMI output. Edit /boot/firmware/config.txt (or /boot/config.txt on older images) as root and uncomment hdmi_safe=1 or set hdmi_group=1 and hdmi_mode=16 for 1080p. Reboot after saving.
  • If all else fails, re-flash the SD card. Use Raspberry Pi Imager to erase the card, then write the image again. This resolves most corrupted-card issues.

Frequently Asked Questions

Can I install Ubuntu on any Raspberry Pi?

No. Ubuntu officially supports Pi 2, 3, 4, 5, and 400. Older models like the Pi 1 or Pi Zero lack the ARMv8 architecture required by modern Ubuntu releases.

Should I choose Ubuntu Server or Desktop?

Server is headless (no GUI) and uses fewer resources—ideal for servers or projects where you access via SSH. Desktop gives you a full graphical interface, better for everyday use or media centers, but requires more RAM and a faster SD card.

How long does the first boot take?

It can take 2–5 minutes on a Pi 4/5, longer on older models. Be patient—the screen may stay black or show a rainbow logo. If it takes more than 10 minutes, check the SD card and image.

Can I dual-boot Ubuntu with Raspberry Pi OS?

Yes, but it's not straightforward. You can use a tool like PINN (a multi-boot loader) to install both OSes on the same SD card. Alternatively, use two separate SD cards and swap them.

Do I need a monitor to install Ubuntu Server?

No. You can enable SSH before first boot by creating an empty ssh file in the boot partition. Then connect via SSH from another computer on the same network.

Will Ubuntu damage my Raspberry Pi?

No. Ubuntu is a supported OS for Raspberry Pi. However, using an underpowered power supply or poor cooling can cause instability, but not permanent damage.