Setting up Raspberry Pi in headless mode

6th September 2017 (3 years ago)

Quick notes (mainly for myself) to make SD card of Raspbian, configure wifi and make SSH run - all before booting the Raspberry Pi.

sudo dd if=/dev/zero bs=4M count=1024 of=/dev/[DEVICE_ID] status=progress  # Wipe card to make sure
sudo dd if=raspbian.img of=/dev/[DEVICE_ID] bs=4M status=progress  # Write the Raspbian image to disk
sudo sync  # Make sure data got flushed to disk

To set up wifi and SSH, remount the drive and create files in the BOOT partition.

touch /path/to/BOOT/ssh
nano /path/to/BOOT/wpa_supplicant.conf

Add the following to wpa_supplicant.conf:

ctrl_interface=/var/run/wpa_supplicant
network={
    ssid="WIFI_NETWORK_SSID"
    psk="WIFI_NETWORK_PASSWORD"
}