Setup headless Raspberry Pi

Written on February 07, 2018

If you’d like to setup your Raspberry Pi headless - without a monitor (the missing "head"), keyboard, and mouse - look no further. This step-by-step guide will walk you through it - assuming a few things: you have a Raspberry Pi 3 Model B, a microSD card and are reading this on a Mac.

  • Download the latest Raspian with Desktop image (currently, that’s Raspian Buster version: February 2020)
  • Expand the 2020-02-13-raspbian-buster.img file from 2020-02-13-raspbian-buster.zip
  • Flash the microSD card with balenaEtcher

  • Enable Secure Shell (SSH) by adding an empty file ssh, without any extension, onto the microSD card’s boot partition $ touch /Volumes/boot/ssh
  • Configure WiFi by adding a file wpa_supplicant.conf onto the SD card’s boot partition $ touch /Volumes/boot/wpa_supplicant.conf and add the following lines (don’t forget to replace YOUR_WIFI_SSID and YOUR_WIFI_PASSWORD):
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="YOUR_WIFI_SSID"
    psk="YOUR_WIFI_PASSWORD"
}
  • Insert the microSD card into your Raspberry Pi and power it up
  • Get the local network IP address of your Raspberry Pi $ ping raspberrypi
  • Connect via SSH $ ssh pi@<YOUR_PI_IP_ADDRESS> (default password for the pi user is raspberry)

If you have been reinstalling Raspian and are using the same IP address, you will most likely get a WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! message. When you establish a new SSH connection, a fingerprint is created and cached on your local machine. Remove the cached key for the IP address $ ssh-keygen -R <YOUR_PI_IP_ADDRESS> and try again to connect via SSH.

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get clean

Martin Buberl

Purveyor of Internet duct tape.
If you'd like to get in touch, feel free to shout @martinbuberl.