Headless Raspberry Pi Zero W Setup

For this guide you’ll need: Linux, an SD-card reader on you desktop or laptop, a raspberry Pi Zero W,  8Gb+ SD card, micro USB power cable and WiFi, you’ll also need some elementary Linux command line knowledge.

Assuming you have the above, the good news is you don’t need to buy a keyboard, HDMI link or monitor to boot (or use) your Pi and so I hope this quick guide saves you time and money.

*This is probably my first foray into hardware. It may be because of that, or because of the wacky-hacky-open-source nature of the whole Raspberry Pi thing that I didn’t find the set-up straightforward. There are others among us who have also had issues with the SD card partitions, booting and initial WiFi hookup. This is a sincere attempt on my part to spare you that pain.

Get Ready – Download Raspbian, Etcher and VNC Viewer

Download Raspbian OS zip from “https://etcher.io/”>here.
Download Etcher from here.
Download VNC Viewer from here.

Snag 1 solved: I’ve read that VNC viewer Linux version doesn’t install normally using Linux’s built in installer, which is annoying. You can get around this by using gdebi.

 sudo apt install gdebi

Also, there’s no need to unzip the Raspbian image.

Then right click the downloaded application and install using gdebi

Step 1 – Burn Raspbian onto SD card

Find the name of your SD device

 sudo fdisk -l

Snag 2 solved. Once you find your disk (e.g. /dev/mmcblk1) I would recommend you completely wipe it and remove any partitions. I had an issue when burning later that etcher decided to create separate partitions for /boot and /root which confuse the installer on your first Raspberry Pi boot. This can be eliminated by burning onto a completely bare SD.

 sudo fdisk /dev/mmcblk1

Then delete all paritions (e.g. mmcblk1p1) until there are none left.

 Command (m for help): d

Safely eject then re-mount your clean SD. Now use Etcher to burn the Raspbian zip onto the SD card, no need to unzip the ISO image! Safely unmount again.

Step 2 – Configure Raspbian for Wifi and SSH

Mount the SD again. We need to change a few things in the stock Raspbian debian OS so that it automatically connects to your WiFi and allows you to SSH (and later remote desktop).

Navigate to the /boot directory on the SD. You can find where the card is mounted by:

 df -h

Once you’re in boot create a file called “ssh” without an extension

 touch ssh

While in /boot, you’ll also need to create a file called wpa_supplicant.conf which the bootloader accesses then permanently moves to the OS file system

 touch wpa_supplicant.conf

Finally, using your WiFi network’s name (SSID) and password (PSK) edit then save the wpa_supplicant.conf file as follows:

 nano wpa_supplicant.conf

An it should look like this assuming you’re in England (GB):

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


Step 3 – Boot your Raspberry Pi! (and enable VNC)

Put the SD in your Raspberry Pi then power up. You should be able to ping it and see it on your WiFi network by running

arp -a

If a new Raspberry Pi device is listed along with an IP, you’ve followed my instructions explicitly and we’re good.

Keep the IP address which comes up near the raspberry pi. E.g. Note – your Raspberry Pi will have a different IP address on different boots in the future as the default setup uses DHCP.

SSH into your Raspberry Pi, so for example with my IP it would look like the below. (default password is raspberry).

ssh pi@

Once you’re in and greeted by a raspberry pi Linux prompt, you  need to enable VNC on the Raspberry Pi by following these instructions.

Step 4 – Use VNC Viewer to control your Raspberry Pi from your laptop

Annoying Bug (14/4/2020) and fix. VNCServer does not automatically boot on your RaspberryPi in the latest versions of Rapsbian, which means that if you try connecting using the graphical window VNC Viewer from your desktop/laptop you’ll get a “Connection Refused Error”. Simple fix I have found for now is manually starting VNC Viewer on your Pi through command line and SSH, before using the GUI. Simply boot and SSH into your Pi as above, then type into the command line:


Which should greet you with something like

Xvnc Free Edition 4.1.1 - built Feb 25 2015 23:02:21
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
Underlying X server release 40300000, The XFree86 Project, Inc

Then. Open RealVNC Viewer (installed in an earlier step), plug in the Raspberry Pi’s IP from previous step and connect!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Facebook photo

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

Connecting to %s