Raspberry Pi Zero W Detailed Setup Guide


The Raspberry Pi Zero W is a small (and affordable) computer on a board – it has the essentials for creating little projects with built-in wi-fi, an HDMI output and an extra USB for input from keyboard / mouse. It runs a Linux distribution (Raspbian usually, but others are supported) and for that reason it’s very versatile and user-friendly, since we can create stuff using pretty much any programming language that can run on Linux. Apart from that, of course, you have the IO header to create circuits and use components to make your project really smart.

This guide will show in detail how to set up a new Raspberry Pi Zero W*. The instructions are based on Ubuntu 16.10 as dev machine – we’ll need to run a couple commands to set up the boot disk (micro SD card) with Raspbian, and later we will connect to the Raspberry Pi Zero W via SSH for further configuration without the need to connect display and keyboard / mouse.

*IF you own a Raspberry Pi Zero without wireless (the Zero model, without “W”), you can simply follow the guide and skip the network part! 


  1. Raspberry Pi Zero W

  2. Micro SD card

Optional but recommended (for GPIO):

  1. 40-pin GPIO male header


  1. A Linux computer to set up the boot disk

  2. Micro SD card reader – USB or adaptor, whatever works for reading and writing to your micro SD card. I find that the USB readers are way more reliable than the microSD to SD adaptors.

  3. A monitor and proper connectors to add a display to your Pi (HDMI port) (you’ll only need these once)

  4. USB keyboard/mouse to configure wi-fi (USB port) (you’ll only need this once)

  5. Soldering equipment to solder the Pin Header (optional)

pi zero setup

notice that this photo shows a RPZ with a soldered pin header. The header usually needs to be soldered by the user, unless you buy the version that includes it by default. Don’t worry – soldering is not a big deal.

1. Setting Up the Micro SD card with Raspbian

To get started, we need to prepare a micro SD card with the system. We’re gonna use Raspbian, which is the official Raspberry distribution.

We’ll start by creating a work directory inside your home, to make everything more comfy:

mkdir Raspberry
cd Raspberry

From your computer, download the latest Raspbian from the command line:

wget http://downloads.raspberrypi.org/raspbian_latest

Now unzip the package and you will have the iso file:

unzip raspbian_latest

If you check the directory now, you should see a file with the .img extension, which is the actual image for the Raspbian disk. We’ll use this in a moment.

We’ll move on to creating the boot disk now. To easily identify which device it will use, first run a dmesg:


Now, connect the SD card and run the same command (dmesg) again. You should see a few log lines related to the newly detected card reader / sd card. This is how it looks like in here – I’m using a USB microSD card reader:

[176495.165391] usb 2-2: new SuperSpeed USB device number 7 using xhci_hcd
[176495.183755] usb 2-2: New USB device found, idVendor=05dc, idProduct=b051
[176495.183771] usb 2-2: New USB device strings: Mfr=3, Product=4, SerialNumber=5
[176495.183781] usb 2-2: Product: microSD RDR 
[176495.183790] usb 2-2: Manufacturer: Lexar
[176495.183799] usb 2-2: SerialNumber: 000000000001
[176495.186257] usb-storage 2-2:1.0: USB Mass Storage device detected
[176495.187745] scsi host11: usb-storage 2-2:1.0
[176496.186820] scsi 11:0:0:0: Direct-Access     Lexar    microSD RDR      0815 PQ: 0 ANSI: 6
[176496.188604] sd 11:0:0:0: Attached scsi generic sg0 type 0
[176496.435758] sd 11:0:0:0: [sda] 30375936 512-byte logical blocks: (15.6 GB/14.5 GiB)
[176496.436432] sd 11:0:0:0: [sda] Write Protect is off
[176496.436446] sd 11:0:0:0: [sda] Mode Sense: 23 00 00 00
[176496.437043] sd 11:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[176496.440836]  sda: sda1 sda2
[176496.445099] sd 11:0:0:0: [sda] Attached SCSI removable disk

So, from the output you can identify that the device was created as “sda”. Another way for identifying the device is by running fdisk, like this:

sudo fdisk -l

You should see information about all your disks, including the sd card or reader. This is how it shows up for me:

Disk /dev/sda: 14,5 GiB, 15552479232 bytes, 30375936 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6c2e18e2

It’s very important that you identify the right disk before running the command we’ll use next – otherwise you risk overwriting important data on your other disks or even breaking your OS!

Now that you identified the right disk, run the dd command to create a boot disk from the Raspbian image:

sudo dd if=/home/erika/Raspberry/2018-04-18-raspbian-stretch.img of=/dev/sda status=progress bs=2048

Naturally, you need to set the “if” parameter to the input file, the Raspbian image we unzipped moments ago. It’s best to set up the full path to the file, so in this case it’s in a “Raspberry” directory inside my home directory. The “of” parameter means “output file”, which is the disk we identified previously (/dev/sda in my case).

This is the output I got here:

4952463360 bytes (5,0 GB, 4,6 GiB) copied, 1080 s, 4,6 MB/s    
2418688+0 records in
2418688+0 records out
4953473024 bytes (5,0 GB, 4,6 GiB) copied, 1080,19 s, 4,6 MB/s

This command will take several minutes to finish, and when it’s done you can remove the card and attach it to your Raspberry Pi Zero W. Plug the USB “Power” cable to turn it on – make sure it’s in the right USB port (it says “PWR” next to it, while the keyboard / mouse USB says “USB”). Attach keyboard and display for the next step.

2. Configure Network

The first time you turn on the Raspberry Pi Zero W with the new system in the micro SD card, it will run some configuration tasks, like resizing the partitions created for the boot disk and adjusting the system, in general. It will automatically start up the graphic user interface, which uses PIXEL as window manager and should look like this:

The easiest way to configure the network is by simply using the GUI tool on the top right position of the screen. Look for an icon that has two blue arrows, between the bluetooth and the audio icons on the menu. Connect to your wi-fi and test the network connectivity to see if you’re connected to the Internet (in case you want so – private network only is also Ok).

If you prefer, you can also use the raspi-config tool to set up the network using the terminal (this way is easier if you don’t have a mouse to access the wi-fi menu in the desktop). Open a new terminal using the keyboard shortcut control + shift + t and type:


Just follow the instructions on the menu “Network Options” – you’re gonna need the name of the wi-fi SSID and the password.

3. Enable SSH access

Now that the Raspberry Pi Zero W is connected to the wi-fi network, we can enable SSH access so we eliminate the trouble of connecting keyboard and mouse to the Pi. For any further configuration, we can simply log in via SSH from our dev machine! Execute the following commands to enable SSH access:

sudo systemctl enable ssh
sudo systemctl start ssh

Now check the IP address with ifconfig, so we can test the connection from our dev machine.


Look for the inet IP address on the wlan0 interface. In my case, it’s, so this is the IP I’ll be using for the rest of the tutorial.

From your dev machine, test the SSH connection with the default credentials: user “pi” and password “raspberry”:

ssh pi@

Don’t forget to change the IP address to reflect your Raspberry Pi address. You should now have SSH access to your Raspberry Pi Zero W!

4. Optional: Set Up and Test GPIO pins

Soldering the IO Pin Header

The Raspberry Pi Zero W comes with 40 ports that can be used to connect the board to all sorts of components and extension boards. In order to use these ports, you should solder a 40-pin GPIO header to the board. Most kits come with a male header like this one:

If you are new to soldering, check our crash-course page on basic soldering.

The most common setup is to solder the pins in order to leave them exposed at the top side of the board, facing up. This way you can “pile” board extensions (pi hats / bonnets) by connecting the boards via GPIO.

This is the board with the soldered header – sorry for the terrible soldering job, but it makes a point: still works fine 😀 Seriously thou, I got much better results after a couple practice sessions.

Now, you might be wondering what you can do with these pins… If you have a breadboard, a LED and a resistor, and a couple wires, we can test the GPIO in real time with a few Python commands. Check out our tutorial: LED blinking on Raspberry Pi Zero.

5. Further Configuration

Disabling / Enabling the GUI

Your Raspberry Pi Zero W is now ready to take any form – in case you are planning on running a server-only thing, it might be a good idea to disable the GUI. In order to do so, run the following command from the Raspberry Pi Zero W shell (either via SSH or with display and keyboard connected):

update-rc.d lightdm disable

To revert this setting and bring back the GUI, you can simply run:

update-rc.d lightdm enable

You can also use raspi-config to disable or enable the Raspbian GUI.

Automation with Ansible

In case you are planning on using multiple Raspberry Pi Zeros as servers, it’s a good idea to automate your setup using a configuration management tool. I shared a basic Ansible setup for Raspbian in this Github repository.

#newbie #guide #basics #stepbystep #boostrap #initialsetup #raspberrypi #raspberry #beginner #detailed #raspberrypizero

7 views0 comments