Skip to content

Instantly share code, notes, and snippets.

@atenni
Last active February 23, 2023 10:56
Show Gist options
  • Save atenni/1cabc375195c9abbf67fe8da93fae1c8 to your computer and use it in GitHub Desktop.
Save atenni/1cabc375195c9abbf67fe8da93fae1c8 to your computer and use it in GitHub Desktop.
Steps to bootstrap a Raspberry Pi (3) without a USB keyboard or mouse, and a WiFi connection only.

Bootstrap Raspberry Pi without a USB keyboard or mouse (2019)

Assumes you have a laptop, WiFi only (no LAN), and a HDMI monitor you can use with the Pi.

Credit: most of this info was found here.

Add OS image to SD card

  1. Download the latest image of Raspbian.
  2. Format your SD card using a tool like SD Memory Card Formatter.
  3. Write Raspbian image to SD card with a tool like Etcher.

Enable SSH

Currently SSH is disabled by default in Raspbian. Without a USB keyboard, this will be the simplest way to access the Pi.

  1. Go to the boot volume created in the last step and add an empty file called ssh in the root folder. For example via the shell:

    cd /Volumes/boot
    touch ssh
    

Preconfigure WiFi

SSH requires network connectivity, but without a LAN connection we need to do this via WiFi. Unfortunately we can't connect to the Pi to set up WiFi, so we need to preconfigure the Pi's WiFi connection.

  1. Create a file called wpa_supplicant.conf in the root of the boot volume with the following contents, replacing <OPTIONS> with your own:

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    country=<TWO_LETTER_ISO_COUNTRY_CODE>
    
    network={
        ssid="<WIFI_NETWORK_NAME>"
        psk="<WIFI_PASSWORD>"
        key_mgmt=WPA-PSK
    }
    

    A full description of wpa_supplicant.conf options can be found here.

Boot your Raspberry Pi and connect

  1. Eject your SD card and insert it into the Raspberry Pi.

  2. Connect the Pi to your monitor to check for problems when the Pi boots for the first time.

  3. Power up the Pi and give it a minute to boot.

  4. From your laptop you should be able to connect via ssh to your Pi with the following details:

    • Default address: raspberrypi.local
    • Default username: pi
    • Default password: raspberry
  5. Change your passwords and continue setting up via SSH as you like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment