Headless Raspberry PI 3 Setup

If you are not using your Raspberry Pi as a desktop with a screen, setting it up in “headless” mode using the Lite version of Raspbian will save precious resources.

This guide will help you to setup your Raspberry Pi 3 without the need for annoying cables and screens or anything else for that matter.

As a word of warning, the snippets in this post are written for macOS. They likely translate well for Linux users. If you are using Windows, you may need to do some extra Googling

REQUIREMENTS:

  • Raspberry Pi 3
  • 8GB+ Micro SD Card (Class 10)
  • Raspbian Lite Image
  • Computer with SD Card Reader (I am using a MacBook)
  • Etcher

INSTALLATION

In Etcher, select your Raspbian image, the correct SD Card and flash it.

WARNING: This will format and erase your SD Card! Make sure you have nothing else plugged in that will confuse the issue. If the drive contains pictures that your significant other has not backed up, you will be in the dog box for a long time.

Etcher

This will burn the image to the SD Card and verify it for you.

Etcher Complete

CONFIGURE THE SD CARD

Do not plug this into the Raspberry Pi yet. This SD card now contains an uninitialised image and on first boot a lot of magic happens to get it into its final state. Fortunately we can tap into this magic and get it to do some work for us too.

Unplug the SD Card and plug it back in. You should now see a volume called boot.

Boot Volume

Firstly, we need to enable SSH on the Pi, this is disabled by default in recent versions of Raspbian. To do this we need to add an empty file to the root of boot called ssh or ssh.txt.

Next we need to setup Wifi. To do this we need to create a file called wpa_supplicant.conf in the root of boot.

Edit the config below to suit your country and wifi setup and add it to the file.

country in the above snippet is the ISO/IEC alpha2 country code for your country. You can find a list here.

For a full example of this config file and all the options take a look here.

Your SD Card is now ready to go. Eject the SD card and insert it into the Pi. You are now ready to power it up. It will take a few minutes to boot, then you will be ready for the next step.

FIRST BOOT

Once the Pi is booted, it will connect automatically to the Wifi network that you specified above. SSH to it using the below command. The default password is raspberry.

For the Windows users, take a look at Putty for SSH.

SSH to Pi

If you see something like the above, you have won. Congratulations!

At this point your Pi has a default password and is likely insecure and not up-to-date. Watch this space for a follow-up on configuring and securing your Pi.