Setting Up A Headless Pi (Raspberry Pi)

Sometimes you may want to set up a Raspberry Pi without connecting it to a TV / monitor, keyboard, mouse or network cable. I recently did this for my Raspberry Pi Zero and decided to create a quick guide in case I need to do it again in the future.

  • Download Raspbian OS, personally I went with Lite version for my Pi Zero as I don’t need a full desktop on it. At the time of writing (March 2019) Raspbian is on the release called Stretch.
  • Write the Raspbian OS to a microSD card. For this step I used my MacBook and the application called Etcher.
  • After writing the Raspbian OS to the microSD card two files need to be added to the root directory of the microSD card:
    • wpa_supplicant.conf
      • This file should be created in a text editor (not a word processor) and should contain the following lines:

        geektechstuff_wpa_supplicant
        wpa_supplicant file
      • country; this is the country code. For Great Britain it is GB. For other countries see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
      • update_config=1
      • ctrl_interface=/var/run/wpa_supplicant
      • network={
      • scan_ssid=1
      • ssid; this should be the name of your wireless network
      • psk; this should be the password used to connect to your wireless network
      • }
    • ssh
      • This is just a blank file, no need for any content or file extension

The microSD can then be placed into the Raspberry Pi and the Pi can be booted. After a few minutes it should show as a connected device on your wireless networks router, and should be reachable via an SSH connection. To connect via SSH open a Terminal (MacOSX, Linux) or Putty (Windows) and connect using:

ssh pi@IP_ADDRESS_OF_PI

Replacing IP_ADDRESS_OF_PI with the Raspberry Pi’s IP address (e.g. 192.168.0.2).

The default password of the user pi is raspberry, once logged in make sure to change this default password to something more secure. To change the password type:

passwd

in the SSH terminal / putty window.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.