So you want to run Ubuntu Server on your Raspberry Pi? Smart move. I've set this up more times than I care to admit – from Pi 3B+ units humming in my garage to Pi 4 clusters running web services. Let's cut through the fluff and get your server running right.
Why Ubuntu Server? Well, when I tried Raspberry Pi OS Lite for my home NAS, updates broke twice in six months. Switched to Ubuntu Server 22.04 LTS and it's been solid for 18 months straight. That long-term support matters.
Before You Start: What You Absolutely Need
Don't be like me last year when I fried a Pi 4 with a cheap power supply. Get these right:
- Raspberry Pi: Ideally Pi 4B 4GB/8GB ($55-$75). Pi 3B+ works but struggles with heavy tasks.
- Power Supply: Official Raspberry Pi USB-C PSU (5.1V/3A). Off-brands cause random crashes.
- Storage: Samsung EVO Select 128GB microSD ($15) or SSD via USB3 adapter (way faster)
- Cooling: Flirc aluminum case ($15) - passive cooling that actually works
- Network: Ethernet cable for initial setup (WiFi works but can be flaky)
Why These Choices Matter
Cheap SD cards corrupt data when power blips. I lost a week's worth of sensor data that way. Spend the extra $8 on endurance cards.
Seriously, cooling isn't optional. Without it, my Pi 4 throttled to 800MHz during backups. Felt like watching paint dry.
Downloading the Correct Image (Don't Mess This Up)
Head to Ubuntu's official Raspberry Pi page. Currently, these are your options:
Ubuntu Version | Pi Model Support | Best For | Gotchas |
---|---|---|---|
Ubuntu Server 22.04 LTS | Pi 3, 3B+, 4, 400 | Most users (supported until 2027) | No Pi Zero support |
Ubuntu Server 20.04 LTS | Pi 2, 3, 4 | Older projects needing stability | Less optimized for Pi 4 |
Ubuntu Core 22 | Pi 3, 4 | IoT/container deployments | Steeper learning curve |
My Recommendation?
Ubuntu Server 22.04 LTS for ARM. I tried Ubuntu Core but missed standard apt commands. The LTS version just works.
Don't use desktop images! They'll crawl on Pi hardware. Server edition uses 40% less RAM.
Flashing the Image: Tools That Won't Fail You
I've used every flashing tool under the sun. Here's what works:
Tool | OS Compatibility | Why I Like It |
---|---|---|
Raspberry Pi Imager | Windows, macOS, Linux | Built-in Ubuntu Server option, verifies writes |
balenaEtcher | All platforms | Foolproof interface |
dd command (Linux/macOS) | Terminal only | Lightweight but easy to mess up |
Step-by-step flashing:
- Insert SD card into computer
- Launch Raspberry Pi Imager
- Choose Operating System > Other general-purpose OS > Ubuntu
- Select Ubuntu Server 22.04 LTS
- Pick your storage device (double-check this!)
- Click Write → Yes to confirm
- Wait until verification completes
Secret Settings Trick
In Raspberry Pi Imager, press Ctrl+Shift+X before writing. Boom - advanced options appear. Set these:
- Hostname: pi-server (or whatever you like)
- Enable SSH: With password authentication
- Username and password: Write these down!
- Wi-Fi: Only if not using Ethernet
- Timezone: Set correctly now
This saves hours of setup later. Learned this after manually configuring 12 Pis for a project.
First Boot: What to Expect
Plug in Ethernet, connect power, and wait. The green LED should blink irregularly. First boot takes 2-5 minutes as it:
- Expands filesystem to fill storage
- Generates SSH keys
- Applies network settings
Find your Pi's IP:
- Check router DHCP list (e.g., 192.168.1.105)
- Use
nmap -sn 192.168.1.0/24
if on Linux - Angry IP Scanner works great on Windows
Now SSH in:
ssh yourusername@pi-ip-address
# Password you set earlier
Initial Configuration Must-Dos
Complete these within 10 minutes of first login:
- Change password:
passwd
(trust me, do this now) - Update packages:
sudo apt update && sudo apt upgrade -y
- Install essentials:
sudo apt install -y vim git ufw fail2ban
Security Lockdown: Don't Skip This
My cousin's Pi got hacked in 3 days. Follow this checklist:
- Firewall setup:
sudo ufw allow ssh sudo ufw enable
- SSH hardening:
sudo vim /etc/ssh/sshd_config # Change these: Port 2222 # Not 22! PermitRootLogin no PasswordAuthentication no # After setting up keys
- Automatic updates:
sudo apt install unattended-upgrades sudo dpkg-reconfigure unattended-upgrades
Generate SSH keys on your laptop, not the Pi. That way you can replace compromised Pis without redoing keys.
Performance Tweaks I Swear By
Tweak | Command/Settings | Impact |
---|---|---|
Zswap (memory compression) | Add to /boot/firmware/cmdline.txt: zswap.enabled=1 |
Reduces swap thrashing |
GPU memory | Set to minimum (16MB) in raspi-config | Frees 128MB RAM for server tasks |
IO Scheduler | Add to /etc/rc.local: echo mq-deadline | sudo tee /sys/block/sda/queue/scheduler |
Better SD card performance |
My Boot Time Savior
Default Ubuntu Server boots in 45s on Pi 4. With this /boot/firmware/config.txt addition:
initramfs initrd.img followkernel
disable_overscan=1
boot_delay=0
Got mine down to 22 seconds. Makes reboots less painful.
When Things Go Wrong (Because They Will)
Boot Failures
- Solid red light: Power issue. Try official PSU
- No IP address: Bad cable or image flash. Re-flash with verification
- Kernel panic: Usually bad SD card. Test with F3 on another computer
SSH Connection Refused?
Try these in order:
- Check Ethernet LEDs are blinking
- Verify router DHCP assignment
- Re-flash with SSH explicitly enabled
- Test with monitor+keyboard:
sudo systemctl status ssh
Last month I wasted hours troubleshooting only to find my kid unplugged the Ethernet cable. Check physical connections first.
What Can You Actually Run?
Forget "hello world" demos. Here's what I run daily:
Service | Resource Usage | Setup Difficulty |
---|---|---|
Pi-hole (ad blocker) | Low (~15% CPU spikes) | Easy (bash script install) |
Home Assistant | Medium (needs Docker) | Moderate (YAML configs) |
Nextcloud | High (avoid on Pi 3) | Complex (LAMP stack) |
WireGuard VPN | Very Low | Easy (scripted setup) |
My current setup: Pi-hole + WireGuard on a $35 Pi 3B+. Uses 0.4 watts at idle.
FAQs: Real Questions from My Workshop
Can I install Ubuntu Desktop instead?
Technically yes, but why? Even lightweight desktops like LXDE choke on 4GB RAM. Server does one thing well.
Why not Raspberry Pi OS Lite?
Ubuntu Server has:
- Newer kernel (5.15 vs 5.10)
- Proper security updates for server packages
- ARM64 architecture support without workarounds
How many concurrent users can it handle?
For web serving:
- Static sites: ~5,000 visits/day (Pi 4)
- WordPress: 500 visits/day with Redis caching
- Database-heavy apps: Keep under 50 active users
Ran a small Mastodon instance for 12 users. Worked until someone posted a viral thread.
Is external SSD worth it?
Night and day difference:
Operation | SD Card | SSD (USB3) |
---|---|---|
Boot time | 45-60 seconds | 12-18 seconds |
Database writes | 15-20 MB/s | 250+ MB/s |
Cost per GB | $0.20 | $0.08 |
Use USB boot (enable in raspi-config) to ditch SD cards completely.
Will it overheat?
Pi 4 throttles at 80°C. With Flirc case:
- Idle: 45-50°C
- Heavy load: 65-70°C
Benchmarked with vcgencmd measure_temp
. Stock case hit 82°C during apt upgrades.
Final Advice Before You Begin
Installing Ubuntu Server on RPi isn't just about following steps. Think about:
- Backups: Use
rpi-clone
to image your SD card monthly - Documentation: Keep a docs.md file in /home with your custom configs
- Monitoring: Install Netdata (
bash <(curl -Ss https://my-netdata.io/kickstart.sh)
)
My biggest mistake? Not labeling cables. Took an hour to trace which Pi was which after a power outage. Learn from me.
Honestly, installing Ubuntu Server on RPi might seem intimidating at first. But once you push past initial setup, it's one of the most reliable platforms I've used. My oldest Pi 4 running Ubuntu Server has 643 days of uptime - only rebooted for kernel updates.
Leave a Comments