Introduction

Every time I receive a new Raspberry Pi, I go through the same error prone discovery process of creating my personal development environment. I know its going to be Python based with Flask, Paho MQTT, Adafruit modules, my own Python models and a standard pi user file structure. I also setup a “systemd” init configuration and modify the .bash_aliases file with “status”, “restart”, “stop”, etc. to manage the process started by the boot sequence.

Since I don’t have the space to add a USB keyboard and mouse to my already crowded desk, I’ve settled on headless servers. IMHO a headless Raspberry Pi server is also an ideal Internet of Things host. This “how to guide” is for Mac OS users like myself.

Getting Started

Go to the Raspberry Pi download page, select the latest “lite” image. You will need to unpack or unzip the file.  Raspian Lite Image

Use Etcher to copy the img file to your SD card. It is usually /dev/disk2. Use Etcher to burn the img to the SD card

Ok, now the fun begins. A headless server needs SSH enabled. Simply create an empty file call “ssh” on the boot level.

cd /Volumes/boot
touch ssh

If you can’t see /Volumes/boot try reinserting the SD card.  You should see the boot volume on Finder.

I’ve standardized on Wi-Fi for most of my devices, which is a must for the Raspberry Pi Zero W. The next step is to configure your local Wi-Fi access point.

vi wpa_supplicant.conf

Insert the following into the blank file on the boot level. NO SPACES!

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="SSID"
psk="PASSWORD"
key_mgmt=WPA-PSK
}

Eject the SD card using finder. Insert it into your Raspberry Pi, power it up and cross your fingers!

First Login to Pi Zero

Special instructions for the Raspberry Pi Zero are needed to attach a Wi-Fi dongle to the USB port. First connect your Pi Zero to your network with a RJ45 connector. Boot the Pi Zero and update/upgrade the OS to support USB/Wi-Fi.

sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo rpi-update

If you get a command not found error on the rpi-update then simply install it with apt-get. Some earlier distributions did not include this command.

sudo apt-get install rpi-update

The latest kernel has changed the /etc/network/interfaces file to use /etc/network/interfaced.d files. What I found that works is to add the following lines to the end of the /etc/network/interfaces file.

cd /etc/network
sudo vi interfaces

Add the following to the end of the file.

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

This may mess up dhcp but I’ve just started working with the Pi Zero USB/Wi-Fi.

First login to Pi Zero W

Login the new server and run raspi-config to set password, hostname and enable I2C.

sudo raspi-config
  • Change the password and hostname
  • Expand memory
  • Enable the camera and I2C bus

Update the operating system with latest.

sudo apt-get update

Configure the Apple Bonjour service and Apple networking

sudo apt-get install avahi-daemon
sudo apt-get -y install netatalk

Edit the .bashrc file to enable ll and other aliases. See systemctl

vi .bashrc

Reboot and test your installation.