Raspberry Pi

Setting up a headless Raspberry Pi

Configuring WLAN (WiFi) when first flashing the SD Card

NOTE: These instructions have been updated (2019-01-15) to work with the latest Raspbian image

It's easiest to do this right after writing the Raspbian disk image to the SD Card. Fill out the config file below (you can edit the yellow text), and write it to one of the two locations listed here:

  • From Windows: /boot/wpa_supplicant.conf (this is the FAT32 partition with cmdline.txt and config.txt)
  • In general: /etc/wpa_supplicant/wpa_supplicant.conf

Enable SSH

On a fresh Raspbian installation you can enable SSH by creating a file named "SSH" on the boot partition, i.e.

    touch /boot/SSH

If you already have console access to the running Raspberry Pi, you can use systemctl instead:

    sudo systemctl enable ssh

Automatically start program on startup

One-off commands are easiest added to /etc/rc.local. Note that everything in this file is executed as root, and any failed command will prevent the system from starting up. Thus I'd generally discourage adding anything here.

As an alternative, you can fairly easily configure new services via system.d. Parse the following service definition into a file, e.g. at:


Then try and permanently enable this service using the commands below:

  sudo ln -s /home/pi/services/foo.service /etc/systemd/system/
  sudo systemctl start foo
  sudo systemctl enable foo

To debug, use:

  systemctl status foo