Contact

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 Stretch version: June 2018)
  • Expand the 2018-06-27-raspbian-stretch.img file from 2018-06-27-raspbian-stretch.zip
  • Flash the microSD card with Etcher

  • 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"
}

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

Developer of all things web in the world's most livable city.
If you'd like to get in touch, feel free to shout @martinbuberl.