How to Set Up a Raspberry Pi Headless with SSH and WiFi
Headless setup lets you run a Pi with no monitor, keyboard, or mouse — just power and network. This is the standard way to set up a Pi for any server or automation project.
What You Need
- Raspberry Pi (any model)
- MicroSD card (8GB minimum, 16GB+ recommended)
- MicroSD card reader
- Raspberry Pi Imager (free — download from raspberrypi.com/software)
- Your WiFi network name and password
Step 1 — Flash the SD Card
- Download and open Raspberry Pi Imager
- Click Choose Device and select your Pi model
- Click Choose OS → Raspberry Pi OS (Legacy, 64-bit) or Raspberry Pi OS Lite (no desktop, smaller)
- Click Choose Storage and select your SD card
- Click the gear icon (or press Ctrl+Shift+X) to open Advanced Options
Step 2 — Configure in the Imager (Critical Step)
In Advanced Options:
- ✓ Enable Set hostname — name it something like
piholeormypi - ✓ Enable SSH → Use password authentication
- ✓ Enable Configure wireless LAN → Enter your WiFi SSID and password → Set your country code (US)
- ✓ Enable Set username and password — change from default
pi/raspberry - ✓ Enable Set locale — set your timezone
Click Save, then click Write.
Step 3 — Boot and Connect
- Insert SD card into Pi, connect power
- Wait 60-90 seconds for first boot
- From your computer, open a terminal and SSH in:
ssh [email protected]
# or if .local doesn't resolve:
ssh [email protected]
Find the IP by checking your router's DHCP client list if .local doesn't work.
Step 4 — First Boot Setup
# Update everything first
sudo apt update && sudo apt upgrade -y
# Run the config tool for any remaining settings
sudo raspi-config
# Reboot after updates
sudo reboot
Troubleshooting
Can't connect via SSH — Double-check that SSH was enabled in the imager. On older Pi OS versions you needed to create an empty file named ssh on the boot partition.
WiFi not connecting — Verify SSID and password. The Pi can't connect to 5GHz-only networks on older models (Pi 3 and earlier are 2.4GHz only).
.local hostname not resolving — Install Bonjour on Windows, or find the IP in your router admin page.
SD card not showing in Imager — Try a different USB port, or use a different card reader.
Tips
- Set a static IP in your router's DHCP reservation table using the Pi's MAC address — prevents the IP from changing
- Add your SSH public key to
~/.ssh/authorized_keyson the Pi to log in without a password - Enable
ufwfirewall after setup:sudo ufw allow ssh && sudo ufw enable