Setup a headless Raspberry Pi Zero W

Setting up a raspberry pi is pretty easy for the most part. But, what if you want to setup a Raspberry Pi without a monitor? We can do the same thing with a B3+ or other version of Raspberry Pi, but for this tutorial I will be using a Zero W.

Things you need before we start

  • Raspberry Pi Zero W
  • Power supply for the pi
  • Micro SD card (Class 10 is usually best for read/write speeds)

Download the operating system

For this tutorial we will be using Raspbian Stretch Lite.
Download it here. Next you will extract the zip file (right click and extract).



Transfer the OS image onto your Micro SD card

Open up Win32DiskImager. If you do not have this application on your computer, you can download it here. Once opened you can choose the .img file that you extracted in the step above and select the device (your SD card) from the dropdown on the right. Finally, click 'write' and once it is completed you can close the disk imager software.



Enable SSH and Setup WiFi

Now that you have your SD card with the raspian operating system there are 2 more steps before you can plug in your pi and start using it. The first is enabling SSH so that you can connect to your pi. To do this, view the contents of your sd card and create a new text file called ssh.

Next you need to create another file: wpa_supplicant.conf (make sure the file extension is .conf) and place it on your sd card just like the ssh file. This file needs to have the following contents:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
     ssid="YourWifiNetworkName"
     psk="YourWifiPassword"
     key_mgmt=WPA-PSK
}

				

Power up your Pi!

Take the sd card out of your computer and pop it into your pi. Power up your pi with the usb power supply and verify the lights are flashing! The next part is a little tricky as you need to know how to access your router to find out what ip address your router gave to your pi. Look at your router model and do a google search on how to acccess your router over your network. For example, to access my router I open my browser and navigate to 192.168.200.1. Find out which IP was assigned to your pi and connect to your pi with Putty.exe (64 bit download here)

Once you are connected to your pi, you will be asked a username and a password to login. By default the username is pi, and the password is raspberry.



Configure your pi / change the defaults

This is the final step. Run the configuration command:

pi@raspberrypi:~ $ sudo raspi-config

				



What comes next is up to you. I usually change the following:

  • password (no brainer)
  • Network options > Hostname (I name my pi's. This one is tyrion because it's so small)
  • Localisation options > I change all of these except the WiFi country
  • Advanced options > Expand filesystem
  • Advanced options > Memory split (I set this to the lowest setting because I won't be using this as a desktop)