Setup a Raspberry Pi Zero W

I have already quite a zoo of Single-Board Computers running Debian derivates, but the latest pet Raspberry Pi Zero W was the first missing standard ethernet.

After all the initial setup including networking and SSH is not dramatically complicated and I was not forced to connect keyboard and video:

Download and Writing to microSD

Download latest Raspbian Stretch Lite image and put the image on an microSD card with at least 4GB (better 8GB) capacity.

I used the standard dd if=*.img of=/dev/... status=progress on the double-checked device for the microSD (lsblk).

If you want to minimize the risk of disk destruction I recommend the Ether Tool instead of dd.

SSH Service on Boot

Activate access to the 1st (boot) and 2nd (root) partition of the card.

First create an empty file ssh on the 1st (boot) partition. This will activate the SSH Service on standard port 22 on boot.

Background

The sshswitch.service unit will only enable the SSH Service, if /boot/ssh or /boot/ssh.txt exists. Since the pi user provides admin privileges by sudo, and the initial password raspberry is well-known, you should be aware of the consequences and change this password immediately.

Introduce WiFi Credentials

Before booting from this microSD for the first time please edit the etc/wpa_supplicant/wpa_supplicant.conf on the 2nd (root) partition and introduce your favorite WLANs.

In the following example I set the country code of the WiFi to the placeholder CC, please replace it by the ISO Code matching your location:

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

network={
    ssid="WLAN-SSID-01"
    #psk="WPA-Password-01"
	psk=348b6a4648bbd19148b3ee4441a87776abe62ef732f567aa86f121d6b414f4da
    priority=1
}

network={
    ssid="WLAN-SSID-02"
    #psk="WPA-Password-02"
	psk=660a6293ecdc6580f8f2917c60d44968c1610604f22ee5df34e315ed5584d98a
    priority=2
}

The network definitions in the file are best generated by the wpa_passphrase tool available on neary any Linux providing WiFi support.

Missing that tool you have still the options of booting without networking falling back to keyboard and display. After login with user pi and password raspberry you can use that tool on the Raspberry Zero itself. Perhaps it’s also possible to use clear text passwords in the psk setting.

Linux-enabled users can run wpa_passphrase SSID PASSPHRASE to get the complete network definition, ready to be pasted into the wpa_supplicant.conf. The priority settings are optional.

Boot

After disconnecting the microSD card and plugging it into the Raspberry Zero you only need power by Micro USB and a defined network within reach to successfully boot the device.

In my case I queried the IP address in my DHCP Service and was able to login to the new member of my LAN within 2 minutes.

One of the first tasks is passwd after logging in as user pi (standard password raspberry). Starting sudo raspi-config will provide further configuration options.