Setup a Raspberry Pi Without a Monitor (Headless Setup) in 6 Easy Steps

Raspberry Pi Headless Setup Post Image

Have you ever needed to setup a Raspberry Pi but you hadn’t a monitor or a mouse or keyboard available?

Or just don’t want to go through the hassle of setting it all up?

Well, my friend, this guide is for you!

It is possible to quickly and easily setup a Raspberry Pi project just using a Raspberry Pi and a wi-fi network.

Make sure you are using a Raspberry Pi with wi-fi built-in (Raspberry Pi 3 model B, B+, or A+, or Zero W). Otherwise, just use a Linux compatible wi-fi adapter that doesn’t require any configuration (aka Plug and Play).

I use this adapter from TP-Link.

Step 1 - Download Raspbian

For this guide, we’re gonna be using the standard Raspbian witch is quite easy to setup headlessly.

You can get Raspbian here.

There are two options available:

  • Raspbian (you use the standard graphical interface to interact with it - for projects that use a monitor)
  • Raspbian Lite (you use the terminal to interact with it - if your project doesn't require a monitor, choose this one)

It doesn’t really matter witch one you choose for this tutorial because both can be setup without a monitor.

Step 2 - Flash SD Card

Once you got your OS image (literally a .img file), you’ll need a proper software to install it on the micro SD card.

For this, I found that the easiest and more recommended solution is Etcher.

Etcher Setup

First, you need to select the .img file that you want to burn to the SD card.

Then you need to select the SD card you want to burn the OS to.

⚠️ WARNING! Make sure you select Raspberry Pi’s SD card and not a different drive. Otherwise you’ll just format the wrong drive loosing all it’s data!

Then, just hit Flash! and you’re good to go.

Step 3 - Headless Configuration

For this step, we’ll need to do two things.

  • Enable ssh (to access the Pi remotely)
  • Configure the network (we do this so that the Pi connects automatically to the network)

Enable ssh

Create an empty file without an extension named ssh (for now, you can just save it to the Desktop).

Configure Network

Create a file named wpa_supplicant.conf with the following contents:

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="wifi-network-name"
    psk="password"
    key_mgmt=WPA-PSK
}

You’ll need to modify this file (country, ssid, psk) according to your network settings.

You should now have these two files:

Raspberry Pi Network Configuration Files

Now copy them to the root of the SD card (the drive called “boot”).

Raspberry Pi Network Configuration Files on SD Card

If you plan on setting up more Raspberry Pis like this, my advice is to save these two files so that next time all you need to do is copy them into the SD card and you’re good to go.

Step 4 - Boot the Pi

Connect the Pi to power and give it a few seconds to boot up.

If your configuration is correct, the Raspberry Pi should now be connected to the wi-fi network.

Note that you’ll only be able to connect to the Pi if it is connected to the same network as you (aka your local network).

Step 5 - Access the Pi via ssh

Now we can connect to the Pi via ssh using it’s IP address or host name.

If you are on Mac OS or Linux, open a terminal and type ssh pi@raspberrypi.local.

When it asks for the password, type raspberry.

If you are on Windows, you'll need an ssh client.

For this tutorial, we’ll use Putty, but any ssh client will do.

Most tutorials out there will tell you to use a tool to find the Pi’s IP address, but here we like to simplify things, so no extra tools or steps will be needed.

When you open Putty, just replace the IP address with raspberrypi.local (assuming you haven’t changed the host name).

Putty Raspberry Pi Configuration

Then click on Open.

It will ask for a username and password.

The defaults are:
username: pi
password: raspberry

Once you input the username and password, you’re in! 🎉

Raspberry Pi SSH Console

Bonus - Access the UI via VNC

We can take this configuration even further and get access to the full desktop environment (if you’re using Raspbian not Raspbian Lite).

To do so, we need to connect to the Pi using VNC (Virtual Network Computing).

Run the following commands to install the VNC server on the Pi:

sudo apt-get update
sudo apt-get install realvnc-vnc-server realvnc-vnc-viewer

Now, we need to allow the Pi to connect via VNC:

sudo raspi-config

Enter Interfacing Options.

Raspberry Pi Software Configuration Tool

Then VNC.

Raspberry Pi Interfacing Options

Now enable it.

Raspberry Pi Interfacing Options Enable VNC

Then navigate to the Finish option using the Tab key.

Raspberry Pi Software Configuration Tool Finish

Once you finish these steps, you’ll need a VNC client to connect to the Pi.

For this, we’ll use VNC Viewer by Real VNC.

Once installed, open it and insert the Pi’s IP address or host name to connect to it.

RealVNC Viewer Raspberry Pi Host Name

Hit Enter and type the username and password (same that you’ve used to connect via ssh).

Raspberry Pi Desktop SSH

After that, you’re all set up!

If you want to activate even more VNC features, you can check the official documentation.

Step 6 - Get Coding!

Now that we have access to the Pi, we can pretty much setup a complete project from the command line.

I hope this guide will serve you well in your future projects.

Did you enjoy this article?

If so, make sure to share it with fellow makers and leave a comment if you have any suggestions on how to improve this guide! 👇

Read Next

Learn To Code By Playing Games Post Image.png
RPi Run Script at Boot Post Image
Code MicroBit with Makecode