Linux 📖 25 min read

Raspberry Pi Setup Guide

Flash the SD card. Boot. SSH in. Everything else is optional.

The Short Version

Don't buy a Raspberry Pi 5 for a server that runs headless. A Pi 4 with 4GB is still the sweet spot for 90% of homelab projects, and they're actually available now.

I have five Pis running around my house — VPN endpoint, ad blocker, monitoring, home automation. At maybe 5 watts each, they cost almost nothing to run 24/7. The setup below is what I do every time.

What You Need

  • Raspberry Pi (Pi 4 recommended, but 3B+ works for lighter stuff)
  • Power supply - Official Pi adapter or any solid 5V/3A USB-C. Cheap ones cause problems.
  • MicroSD card - 32GB minimum, Class 10 or better
  • Ethernet cable (optional but recommended for headless setup)
  • Case (optional but helps with heat)

Skip the starter kits unless you need accessories. They often include stuff you won't use.

Imaging the SD Card

Use the Raspberry Pi Imager. It handles hostname, SSH, WiFi, and username/password in one shot — no more manually creating wpa_supplicant.conf or touching an empty SSH file. Grab it from raspberrypi.com.

  1. Insert SD card into your computer
  2. Open Raspberry Pi Imager
  3. Choose OS: Raspberry Pi OS Lite (no desktop) for server/headless use — it uses half the RAM
  4. Choose storage: your SD card
  5. Click the gear icon - This opens advanced options. Important!

Advanced Options (Don't Skip This)

In the settings menu:

  • Set hostname - Something like "pihole" or "vpnserver"
  • Enable SSH - Check this! Use password authentication
  • Set username and password - Don't use defaults
  • Configure WiFi (if not using Ethernet)
  • Set locale - Timezone, keyboard layout

This pre-configures everything so you can just boot and connect via SSH. No monitor needed.

First Boot (Headless)

  1. Insert SD card into Pi
  2. Connect Ethernet (or rely on WiFi if configured)
  3. Plug in power
  4. Wait 1-2 minutes for first boot

Find your Pi's IP address from your router's DHCP leases, or try:

ping raspberrypi.local
# Or use your custom hostname
ping pihole.local

Connect via SSH:

ssh [email protected]

Key First Steps

Update Everything

sudo apt update && sudo apt upgrade -y

Always first thing. Gets security patches and bug fixes.

Expand Filesystem (Usually Automatic)

Modern Raspberry Pi OS auto-expands, but verify:

df -h

Your root partition should show your full SD card size.

Set Static IP (For Servers)

sudo nano /etc/dhcpcd.conf

Add at the bottom:

interface eth0
static ip_address=192.168.1.100/24
static routers=192.168.1.1
static domain_name_servers=1.1.1.1 8.8.8.8

For WiFi, change eth0 to wlan0. Reboot to apply.

Basic Security

# Install firewall
sudo apt install ufw
sudo ufw allow ssh
sudo ufw enable

# Install fail2ban (blocks brute force attempts)
sudo apt install fail2ban

SSH Key Authentication

More secure than passwords. On your local machine:

# Generate key if you don't have one
ssh-keygen -t ed25519

# Copy to Pi
ssh-copy-id [email protected]

Now you can SSH without a password.

Optional: Disable password authentication entirely:

sudo nano /etc/ssh/sshd_config
# Set: PasswordAuthentication no
sudo systemctl restart sshd

Warning: Make sure your key works first!

Performance Tweaks

Reduce SD Card Wear

SD cards have limited write cycles. Reduce logging with:

sudo nano /etc/fstab

Add:

tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0
tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=100m 0 0

This puts temp files and logs in RAM. Reboot to apply.

USB Boot (Pi 4)

SSDs are faster and more reliable than SD cards. Pi 4 can boot from USB:

  1. Flash Raspberry Pi OS to a SSD/USB drive
  2. Connect to an USB 3.0 port (blue)
  3. Pi 4 should boot from it automatically

Night and day difference over SD cards, especially for anything doing writes.

Docker on Pi

Docker runs fine on Pi. Install:

curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
# Log out and back in

# Test
docker run hello-world

Many images have ARM builds now. Check Docker Hub for arm64 or armhf versions.

What to Run on Your Pi

Perfect for Pi

  • Pi-hole - Network ad blocking
  • WireGuard - VPN server
  • Home Assistant - Smart home controller
  • Unifi Controller - Manage Ubiquiti network gear
  • Monitoring agents - Feed data to Grafana

Works, But Push Its Limits

  • Nextcloud - Works but slow for large files
  • Plex/Jellyfin - No transcoding, direct play only
  • Databases - Fine for small workloads

Don't Bother

  • Heavy transcoding workloads
  • Multiple simultaneous video streams
  • Applications requiring lots of RAM

Multiple Pis?

Once you've a few, organization helps:

  • Name them clearly (pihole, vpnpi, mediabox)
  • Add local DNS entries so you can access by name
  • Document what runs where
  • Use Ansible for managing multiple at once

When Things Go Wrong

Red/Green LED Not Blinking

SD card issue. Re-image or try a different card.

Rainbow Screen

Power issue. See the note above about power supplies. The $8 official adapter saves hours of debugging.

Can't Find on Network

  • Is Ethernet/WiFi connected?
  • Check router's DHCP leases
  • Try nmap scan: nmap -sn 192.168.1.0/24

Running Slow

  • Check temperature: vcgencmd measure_temp
  • Over 80°C means it's throttling. Add cooling.
  • Check SD card speed. Cheap cards are slow.

Keep It Running

Pis are reliable but check on them occasionally:

# Set up automatic updates
sudo apt install unattended-upgrades
sudo dpkg-reconfigure --priority=low unattended-upgrades

And periodically reboot for kernel updates:

sudo reboot

Key Takeaways

The only thing that matters: use Raspberry Pi Imager, enable SSH in the settings before flashing, and set a real password. Everything below expands on that.

🔌 Power supply matters: The number one Raspberry Pi issue I see people hit is an underpowered USB adapter. Symptoms: random crashes mid-task, the yellow lightning bolt icon in the corner of the screen (that's the throttling warning), and — worst case — SD card corruption that makes you re-flash everything. Get the official Raspberry Pi power supply for your model, or at minimum a known-good 5V/3A USB-C adapter. Not the phone charger from your nightstand. Not the one that came with some random tablet. A proper 5V/3A supply. The $8 difference saves you from hours of "why does my Pi keep freezing" troubleshooting.

From here you can install Docker, set up Pi-hole, run a NAS — whatever. The Pi doesn't care what you put on it.

💬 Comments