Jacob Kaplan-Moss

Today I Learned…

Setting up a headless Raspberry Pi

Last night I set up a new Raspberry Pi - this one to attach to a document scanner to make a paper-to-cloud device. Every time I do this I have to look up the specific steps to required to set up a headless (i.e. not attached to a monitor) Raspberry Pi. As Simon has observed, one of the best uses of a personal blog is to make notes to your future self. So, future Jacob, here’s now you set up a headless Raspberry Pi:

  1. Use Raspberry Pi Imager to burn the image to an SD card. You probably want the “Raspberry Pi OS Lite” image.

  2. On the image (which will be in /Volumes/boot on macOS):

    1. touch ssh to allow SSH access.

    2. create wpa_supplicant.conf:

      country=US
      ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
      update_config=1
      
      network={
      scan_ssid=1
      ssid="your_wifi_ssid"
      psk="your_wifi_password"
      }
      
  3. Boot the thing.

  4. ssh [email protected]; the default password is raspberry.

  5. sudo raspi-config, change (at minimum) the hostname and pi user password, then reboot.

  6. ssh [email protected].

  7. sudo apt update && sudo apt upgrade.

  8. Reboot one more time, if needed (e.g. if there was a kernel update).