Headless Raspberry Pi Setup with Raspbian Jessie

The goal of this procedure is to describe a generic way of setting up a Raspberry Pi without having to attach a screen or keyboard to it.

Prerequisites

Before starting, you’ll need the following hardware:

  • a Raspberry Pi
  • a 8GB microSD card with SD adapter
  • a 5V/2A microUSB power supply
  • optionally, a USB WiFi dongle, depending on the model Raspberry Pi

On the software side, following bits are required:

Prepare SD card

Insert the microSD card in your computer, using the SD card adapter and run the Etcher software.

  • Step 1: Select the downloaded Raspbian image (no need to unzip!)
  • Step 2: No action should be required, but it is recommended to verify Etcher picked the correct drive
  • Step 3: Flash!

Once the OS has been flashed onto the SD card, some files need to be added in order to enable SSH access and have the Pi connect to the desired network via WiFi.

Etcher automatically ejects the drive when the flashing procedure is completed, so you may have to remove and reinsert the microSD card in your computer.

  • to enable SSH access, create an empty file called “ssh” (no file extension!) and put it on the microSD card (/boot)
  • to enable WiFi, create a file called “wpa_supplicant.conf” with following content, on the microSD card (/boot):
Replace “<your_ssid>” and “<your_password>” with the values matching your own wireless network and save the file. Upon first boot, the file will be moved to the correct location on the filesystem.

First boot

The microSD card is ready, time to boot up the Pi!

Safely eject the microSD card from your computer and insert it in your Raspberry Pi. Connect the WiFi dongle if your Pi doesn’t have onboard WiFi, and plug in the power adapter. Wait a moment for the Pi to completely boot, then, verify it is accessible.

In a terminal, try pinging the Pi using following command:

After confirming the Pi is on the network, connect to it via SSH. In Linux and OSX, you can do this via the terminal, in Windows using PuTTY.

The default SSH password is “raspberry”.

Configuration

On the command line, execute following command to start the configuration tool:

It is highly recommended to change the default password to something different. This can be done using the “Change User Password” menu option.

I personally like to change the hostname of every Pi in order to be able to differentiate them. To change the hostname, use the “Hostname” option.

Finally, to use all the space available on the microSD card, choose the “Expand Filesystem” option in the “Advanced Options”. In the latest version of Jessie this is done automatically.

A reboot is required to apply all changes, which will be asked by the configuration tool upon finish.

Update/Upgrade

The final step is to update the software to the latest version.

Use the package manager to update the package lists to the latest version and initiate the upgrade.

Perform a final reboot, and you’re done.

Ready

The Pi is now connected to the network, running the latest software and ready to become part of a new project!

What will you be making?

19 thoughts on “Headless Raspberry Pi Setup with Raspbian Jessie”

  1. A nice tutorial.

    BUT if you use pibakery at http://www.pibakery.org would save a lot of work.
    You can set even up the WiFi. A really g0ood tool.
    Appantly there will be a new version at the end of March so it would be better go get that one when id arrives.

    1. Looks interesting indeed, I’ll have to check it out 🙂

      But I guess both approaches each have their pros and cons. With PiBakery, you are tied to the baked in image it seems (which makes it a 1.8GB download). Does it support different OSes?

      1. My old version has just updated the image to the latest Version and the Light version.
        Whether the new PiBakery support all available OS’s ifs not known.
        Pibakery is on twitter so perhaps a tweet there would not go amis.

        PS. I couldn’t get LAMP install to work, but will work on that.

  2. Thanks for this tip. How could I go this long and provision so many raspis. This will save me a lot of time.

    Thank you.

  3. This is just something extra that I learnt from your excellent article. I hope you don’t mind me sharing. Thank you very much for posting this article and sharing your knowledge.
    After powering up my raspberry pi zero after making the changes in the card’s root I powered it down and looked at the SD card again. I could not see the “wpa_supplicant.conf” file. I understand now that the operating system copies the file to where it needs to go then deletes the file from the microSD card’s root.
    Also in Windows I created the file ‘ssh’ but there was not just an option I believe to just create a file so I made a text file ‘ssh.txt’ then deleted the .txt bit which left just ‘ssh’ as a file. seemed to work.
    I found this article from http://www.recantha.co.uk/blog/

    1. I don’t mind at all! Thank you for the feedback, I’ve added some small notes in the text to cover it 🙂

      As for the file extension, I remember a trick in notepad when saving a file: if your put quotes (“”) around the file name, it should save as is, without adding a .txt extension.

  4. Very clever way of setting ssh and the wifi. Thanks a lot.
    I have a Pi Zero W and would like to just have the Jessie lite version on it but I just can’t get bluetooth to work reliably.
    Would you have a tutorial for Jessie lite and Bluetooth?

  5. It seems that bluetooth requires pulseaudio whcih really requires a desktop version itself. I have tried many things but have come to the conclusion that bluetooth is at best unstable on Jessie Lite.
    I would love to be proven wrong 🙂

  6. I have followed your tutorial and I think A small correction is required 🙂

    You say to put the ssh file and wpa_supplicant.conf in the root partition but it should be in /boot (as shown in the picture)

  7. It could be something specific to me then. I am very new to The Pi world so excuse my lack of knowledge.
    When I insert the SD card in my laptop it shows 2 partitions. 1 is the / and the other is /boot.

    I initially put the files in / and it didn’t work. That is when I then saw the picture and realised I put them in the wrong place 🙂

    1. I’m only seeing one partition, so I was not aware this could cause confusion 🙂 I’ve added the fact that it’s “/boot”. Thanks for the feedback!

Leave a Reply

Your email address will not be published. Required fields are marked *