Raspberry Pi Ubuntu runs on Pi 4 and Pi 5 in two flavours: Ubuntu Server 24.04 LTS for headless container and service deployments, and Ubuntu Desktop 24.04 LTS for a full GNOME desktop environment. Ubuntu does not support Pi Zero, Pi 1, Pi 2, or Pi 3 in its current releases.
This guide covers flashing both images with Raspberry Pi Imager, Ubuntu Server’s cloud-init headless first-boot process (the empty ssh file method does not work on Ubuntu), Netplan static IP configuration, Ubuntu Desktop hardware requirements and lightweight alternatives, and essential post-install tasks including Snap management and UFW. For the decision between Ubuntu and Raspberry Pi OS for your specific use case, see Raspberry Pi OS vs Ubuntu Server: Which One Should You Actually Use?
Last tested: Ubuntu Server 24.04.2 LTS and Ubuntu Desktop 24.04.2 LTS | May 2025 | Raspberry Pi 4 Model B (8GB) and Raspberry Pi 5 (8GB)
Key Takeaways
- Ubuntu Server on Raspberry Pi uses cloud-init for headless first-boot configuration. The old Raspberry Pi OS method of adding an empty
sshfile to the boot partition does not work on Ubuntu. Configure SSH access by editing theuser-datafile in thesystem-bootpartition before inserting the SD card. Alternatively, use Raspberry Pi Imager’s OS customisation settings, which writes the necessary cloud-init configuration automatically. - The default user on a fresh Ubuntu Server for Pi installation is
ubuntuwith passwordubuntu. Ubuntu forces a password change on first SSH login. If Raspberry Pi Imager’s advanced settings were used, the username and password set there replace the default credentials. Change the default password immediately if using the manual cloud-init method. - Snap packages on Ubuntu Server add boot time, disk usage, and AppArmor complexity. After install, limit snap version retention and disable cloud-init if persistent boot delays appear. Both are one-time setup tasks described in the post-install section below.
Flashing Raspberry Pi Ubuntu Images with Raspberry Pi Imager

Raspberry Pi Imager is the correct tool for flashing Ubuntu images to microSD or USB storage. It includes Ubuntu Server and Ubuntu Desktop in its OS library. Download Imager from raspberrypi.com/software.
Open Imager, click “Choose OS,” navigate to “Other general-purpose OS,” then “Ubuntu.” Select Ubuntu Server 24.04 LTS for a headless server build, or Ubuntu Desktop 24.04 LTS for a desktop environment. Both are ARM64 images and require a Pi 4 or Pi 5.
Before clicking Write, open the OS customisation settings (the pencil icon). Set hostname, username, password, and enable SSH with public key authentication. For Ubuntu Server, these settings write the correct cloud-init user-data configuration to the system-boot partition automatically. This is how headless SSH access is configured on Ubuntu, not the empty ssh file method.
Write to a microSD card (minimum 16GB, class 10 or better) or a USB SSD. For Pi 4 and Pi 5, a USB SSD is more reliable for server builds. See Raspberry Pi 5 NVMe Boot: Complete Setup Guide for Pi 5 NVMe boot.
Expected result: After writing, the storage device contains two partitions: system-boot (the FAT32 boot partition, visible on Windows/macOS) and writable (the ext4 root partition). The user-data and network-config files in system-boot contain the cloud-init configuration. Do not format the card before flashing. Imager handles partitioning.
Ubuntu Server on Raspberry Pi: First Boot and cloud-init
Insert the flashed storage, connect Ethernet (WiFi can be configured post-boot but Ethernet avoids cloud-init WiFi complexity on first boot), and power on. Ubuntu Server’s first boot runs cloud-init, which configures the system, sets up the user account, and enables SSH. First boot takes 2 to 5 minutes. The Pi is ready when SSH accepts connections.
SSH in using the credentials set in Imager, or with the defaults if manual cloud-init was used:
ssh ubuntu@[pi-ip-address]
# Default password if not set in Imager: ubuntu (forced change on first login)
Find the Pi’s IP from your router’s DHCP client list, or use arp-scan from another machine: sudo arp-scan -l | grep -i raspberry.
Update the system immediately after first login:
sudo apt update && sudo apt full-upgrade -y
sudo reboot
Disable cloud-init after first boot to eliminate the 10-15 second boot delay on subsequent reboots:
sudo touch /etc/cloud/cloud-init.disabled
sudo systemctl disable cloud-init cloud-init-local cloud-config cloud-final
Configure a static IP with Netplan. Ubuntu uses Netplan for network configuration, not NetworkManager or dhcpcd. Edit the Netplan configuration:
sudo nano /etc/netplan/50-cloud-init.yaml
Replace the DHCP configuration with a static address block:
network:
version: 2
ethernets:
eth0:
addresses:
- 192.168.1.50/24
nameservers:
addresses: [192.168.1.1, 8.8.8.8]
routes:
- to: default
via: 192.168.1.1
Apply the configuration:
sudo netplan apply
Expected result: ip addr show eth0 shows the static IP. ping -c 3 8.8.8.8 succeeds. If the Pi loses connectivity, SSH may disconnect. Connect a monitor and keyboard to debug, or revert by booting with the old SD card and correcting the YAML indentation (Netplan is strict about YAML formatting. Use spaces, not tabs).
Ubuntu Desktop on Raspberry Pi
Ubuntu Desktop 24.04 LTS with the GNOME desktop environment requires a Pi 4 or Pi 5 with at least 4GB RAM. On 2GB RAM, GNOME is usable but sluggish. On 1GB RAM, it fails to load reliably. If the project needs a desktop environment on a Pi 4 (2GB), a lighter alternative is the better choice.
For lighter desktop environments on Ubuntu:
# Install XFCE (lightest, runs on 1GB RAM):
sudo apt install -y xubuntu-desktop
# Install MATE (balanced, runs on 2GB RAM):
sudo apt install -y ubuntu-mate-desktop
Log out after installation and select the new desktop environment from the gear icon on the login screen. Removing the GNOME packages after installing a lightweight environment reclaims significant disk space and RAM at idle:
sudo apt remove -y gnome-shell ubuntu-desktop
sudo apt autoremove -y
Ubuntu Desktop’s first boot launches a graphical setup wizard for language, WiFi, user account, and timezone. No cloud-init involvement on the Desktop image. The default user is whoever was created in the setup wizard or in Raspberry Pi Imager’s advanced settings.
For remote desktop access to Ubuntu Desktop on Pi from another machine, install xrdp:
sudo apt install -y xrdp
sudo systemctl enable --now xrdp
Connect using Windows Remote Desktop (mstsc) or Remmina on Linux/macOS at the Pi’s IP address on port 3389.
Post-Install: Snap, Docker, UFW, and Performance
Managing Snap packages. Ubuntu installs several applications as Snaps by default. Snap packages each add a loop device mount, consume disk space for multiple cached versions, and add startup time. Limit version retention after install:
sudo snap set system refresh.retain=2
To remove a Snap and replace with the APT equivalent (Firefox as an example):
sudo snap remove firefox
sudo apt install -y firefox
Installing Docker on Ubuntu Server for Pi. The official Docker install script handles Ubuntu ARM64 correctly:
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
Log out and back in for the group change to take effect. Verify with docker run hello-world. For the complete Docker and Portainer setup on Raspberry Pi, see Docker on Raspberry Pi 5: Complete Beginner Stack with Portainer Guide.
Enabling UFW (firewall). Ubuntu includes UFW but it is not enabled by default. Enable it with SSH allowed before activating to avoid locking yourself out:
sudo ufw allow ssh
sudo ufw limit ssh
sudo ufw enable
sudo ufw status
Performance notes. Ubuntu Server on Pi 4 (4GB) idles at approximately 200-350MB RAM, significantly more than Raspberry Pi OS Lite’s 60-100MB at idle. This is mainly the Ubuntu base system and systemd services. For a Pi 4 (2GB) running Docker containers, Ubuntu Server’s higher idle RAM usage leaves less headroom than Raspberry Pi OS Lite. The RAM overhead is worth accepting when Ubuntu-specific software compatibility (K3s, ARM64 snaps, Ubuntu-targeted images) justifies the choice. For a straight NAS, Pi-hole, or single-service deployment on 2GB RAM, Raspberry Pi OS Lite is the more efficient base.
FAQ
Which Raspberry Pi models support Ubuntu?
Ubuntu 24.04 LTS officially supports Raspberry Pi 4 and Raspberry Pi 5 (both 4GB and 8GB variants). Pi 3 support was dropped after Ubuntu 20.04. Pi Zero, Pi Zero W, Pi Zero 2W, Pi 1, and Pi 2 are not supported by current Ubuntu releases. For those boards, Raspberry Pi OS is the only practical option. Check ubuntu.com/download/raspberry-pi for the current supported hardware list.
How do I enable SSH on Ubuntu Server for Raspberry Pi?
Use Raspberry Pi Imager’s OS customisation settings before flashing. Enable SSH and paste your public key in the advanced settings. Imager writes the correct cloud-init user-data configuration automatically. Do not use the empty ssh file method from Raspberry Pi OS guides. It does not work on Ubuntu Server. If you need to add SSH access post-install without Imager, edit /etc/ssh/sshd_config to ensure PasswordAuthentication yes is set, then restart SSH: sudo systemctl restart ssh.
Can Ubuntu Desktop run on a Raspberry Pi 4 with 2GB RAM?
GNOME Desktop is not reliable on 2GB RAM. Ubuntu’s full GNOME environment uses 800MB to 1.2GB at idle, which leaves insufficient memory for applications on a 2GB system. A lighter desktop environment (XFCE or MATE) installed on top of Ubuntu Server is usable on 2GB RAM. Alternatively, Raspberry Pi OS Desktop on a 2GB Pi 4 is more optimised for the hardware and provides a better experience at that RAM level.
How do I set a static IP on Ubuntu Server for Raspberry Pi?
Ubuntu Server uses Netplan, not NetworkManager or dhcpcd. Edit /etc/netplan/50-cloud-init.yaml, replace the DHCP configuration with a static address block including addresses, nameservers, and a default route, then run sudo netplan apply. YAML indentation is critical. Use two-space indentation and no tabs. A router DHCP reservation is simpler and survives OS reinstalls without requiring any Netplan changes.
Should I use Ubuntu or Raspberry Pi OS on Raspberry Pi?
It depends on the workload. Use Raspberry Pi OS for GPIO projects, education, Pi-hole, NAS, print servers, and any project on less than 2GB RAM. Use Ubuntu Server for Docker/Kubernetes deployments where ARM64 container compatibility matters, K3s clusters, or when the software stack specifically targets Ubuntu. For most homelab workloads, Raspberry Pi OS Lite 64-bit is the more efficient starting point. For the full comparison, see Raspberry Pi OS vs Ubuntu Server: Which One Should You Actually Use?
References:
- Ubuntu for Raspberry Pi: ubuntu.com/download/raspberry-pi
- Ubuntu cloud-init documentation: cloudinit.readthedocs.io
- Netplan documentation: netplan.io/reference
- Docker install script: get.docker.com
- Raspberry Pi Imager: raspberrypi.com/software
About the Author
Chuck Wilson has been programming and building with computers since the Tandy 1000 era. His professional background includes CAD drafting, manufacturing line programming, and custom computer design. He runs PidiyLab in retirement, documenting Raspberry Pi and homelab projects that he actually deploys and maintains on real hardware. Every article on this site reflects hands-on testing on specific hardware and OS versions, not theoretical walkthroughs.
Last tested hardware: Raspberry Pi 4 Model B (8GB) and Raspberry Pi 5 (8GB). Ubuntu Server 24.04.2 LTS and Ubuntu Desktop 24.04.2 LTS, May 2025.

