Raspberry Pi OS Headless Setup

When you don’t have or feel like hooking up a monitor and keyboard

Photo by Jeff Loucks on Unsplash

We will be installing a headless version of the Raspberry Pi OS, which can
be downloaded from the Raspberry Pi Foundation here: https://www.raspberrypi.org/software/operating-systems/

As of April 2021, the three downloads available are:

  1. Raspberry Pi OS with desktop and recommended software
  2. Raspberry Pi OS with desktop
  3. Raspberry Pi OS Lite

We will be downloading Raspberry Pi OS Lite, which is a headless version of the OS. That is, there is no graphical user interface available. We will instead enable the SSH server as part of the installation process and login via an SSH client.

After downloading the OS Lite ZIP file, we need to extract it to an IMG file and then flash it to a microSD card (8GB minimum). Once the card is flashed, eject it and reinsert the SD card into your computer. You should now see a volume called `boot`. On MacOS, this will be located at `/Volumes/boot`.

Open a terminal and navigate to the boot volume:

cd /Volumes/boot

If you list the files `ls`, you should see a collection similar to the following:

λ /Volumes/boot/ ls
COPYING.linux bootcode.bin kernel7.img
LICENCE.broadcom cmdline.txt kernel7l.img
bcm2708-rpi-b-plus.dtb config.txt kernel8.img
bcm2708-rpi-b.dtb fixup.dat overlays
bcm2708-rpi-cm.dtb fixup4.dat start.elf
bcm2708-rpi-zero-w.dtb fixup4cd.dat start4.elf
bcm2708-rpi-zero.dtb fixup4db.dat start4cd.elf
bcm2709-rpi-2-b.dtb fixup4x.dat start4db.elf
bcm2710-rpi-2-b.dtb fixup_cd.dat start4x.elf
bcm2710-rpi-3-b-plus.dtb fixup_db.dat start_cd.elf
bcm2710-rpi-3-b.dtb fixup_x.dat start_db.elf
bcm2710-rpi-cm3.dtb issue.txt start_x.elf
bcm2711-rpi-4-b.dtb kernel.img

To enable the SSH server, simply add a file named `ssh` to this directory:

touch ssh

If you’re going to connect the Raspberry Pi to your network directly via an ethernet cable go ahead and skip the next step, otherwise follow along. Now we’re going to provide WiFi credentials with a text file called `wpa_supplicant.conf`. Open up your preferred text editor and create `wpa_supplicant.conf` inside of the `/Volumes/boot` directory with the following content:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

This configuration file is setup for a primary (`priority=2`) and a secondary (`priority=1`) WiFi network. That is, if both of the networks above are available, the one with the highest priority value will be the one the Raspberry Pi attempts to connect with. If you don’t have more than one network, the second block can be ignored. Substitute the credentials you have for `ssid`, `psk`, and `id_str`, for the Wifi SSID, password, and a unique ID of your choosing, respectively. Once this file is saved, eject your microSD card and insert it into the Raspberry Pi. Provide power to the device and check your WiFi router to see if it’s connected.

My WiFi router serves up a web interface on ``. Check your router for this info as well as a username and password. After checking the connected devices on my WiFi network, I see there’s a device with a hostname of `raspberrypi` and IP address ``. Note that your IP addresses will most likely be different.

Let’s login to the Raspberry Pi with our SSH client. Open a terminal and type the following (note use your Raspberry Pi’s IP address in lieu of

ssh pi@

You will likely get a warning such as `The authenticity of host ‘ (’ can’t be established […] Are you sure you want to continue connecting (yes/no/[fingerprint])?`. Go ahead and enter`yes` and you’ll be prompted for a password. The default password is `raspberry`. After a successful login, you’ll be greeting with a terminal similar to the following:

Linux raspberrypi 4.19.118-v7+ #1311 SMP Mon Apr 27 14:21:24 BST 2020 armv7l

Go ahead and run the following commands to make sure your OS is completely up to date:

sudo apt-get update
sudo apt-get upgrade

Congrats! You’ve successfully installed a headless version of Raspberry Pi OS and connected via SSH.

Fullstack Systems Engineer @ Technicity LLC, Runner, Transplant Carioca.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store