Setting Up the Raspberry Pi Zero W as a Headless Server

The other day I was fortunate enough to be able to purchase a Raspberry Pi Zero W from Adafruit. You can’t beat a fully functioning $10 wireless computer. I, of course, wanted to setup the Zero W as a headless server but I couldn’t directly plug it into my network due to the lack of an Ethernet port.

Luckily I found a post that gives directions on how to setup the RPi Zero W to automatically connect to a wireless network.

After installing a fresh Raspbian image on an SD card, mount the root partition (not the boot partition) by using a fuse-ext2 on a Mac or another Linux distribution.

Open the network interfaces file for editing.

$ sudo nano /etc/network/interfaces

Modify the following section from

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


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

Next, edit the wpa_supplicant.conf file.

$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add your network information to the end of the file.

  ssid="your network name"
  psk="your network password"

Enabling SSH for A Headless Raspberry Pi

On November 30th, 2016, the Raspberry Pi Foundation decided to disable SSH by default in Raspbian for securing reasons. I understand the decision and fully support it. This, of course, is a little inconvenient for those of us that setup our Raspberry Pis as headless servers and don’t want to pull out peripherals and monitors every time we want a fresh setup. Luckily there’s a solution.

Simply create an empty file labeled ssh in the boot directory after the Raspbian image is installed.

$ touch /bootmountpoint/ssh

Google Drive Utility On Raspberry Pi

I’ve finally gotten back to updating and reconfiguring my Raspberry Pi 2 as a headless server and was browsing the forums to see if there’s any other services that I can add. I came across a post on how to add a push and pull utility for Google Drive. Apparently, a Googler, Burcu Dogan, that works on the Drive team abandoned the drive project that can be used on a Linux system and Emmanuel T Odeke has since picked it up.

Here are the directions for installing it on the Raspberry Pi:

See what version of ARM processor you are using (ARMv6, ARMv7, ARMv8, etc.).

$ cat /proc/cpuinfo | grep "model name"

Browse the drive releases and copy the latest arm binary release URL.

Make the Google Drive directory.

$ mkdir /your/drive/directory

Download the drive binary.

$ wget -O /usr/local/bin/drive

Make the binary executable.

$ sudo chmod +x /usr/local/bin/drive

Initialize drive

$ drive init /your/drive/directory

Open up the Oauth2 link in a browser, copy the key, and paste it into the Raspberry Pi console.

You should be good to go!

Tested on:

  • 05/02/2016
  • drive v0.3.4
  • Raspberry Pi 2 (BCM2709)
  • Raspbian Jessie (8)

Get Notified When Your Raspberry Pi is Booted with Pushbullet

When working with a headless Raspberry Pi, it’s nice to know when it’s back up and running during a restart. An easy way of becoming notified when your RPi is finished booting is to have it send a notification through the phenomenal service, Pushbullet. According to their website:

Pushbullet connects your devices, making it easy and automatic to share almost anything between them.

Through Pushbullet’s API, you can send yourself notifications to your desktop or to your phone.

Pushbullet Setup Instructions

The first thing you need to do is create a Pushbullet account.

Then install their mobile app for Android or iPhone, or Firefox or Chrome extension.

Grab your Pushbullet access token from your account page.

Test that Pushbullet is working from your RPi command line using curl.

$ curl -u <your_access_token_here>: -d type=note -d title="Raspberry Pi" -d body='Raspberry Pi is up!'

Raspberry Pi Setup Instructions

We’re going to send our Pushbullet command using the rc.local file which is executed once our RPi has finished booting.

Make a backup of your rc.local file.

$ sudo cp /etc/rc.local /etc/rc.local.backup

Open up the rc.local file using nano.

$ sudo nano /etc/rc.local

Add the curl command right before the exit 0 command.

curl -u <your_access_token_here>: -d type=note -d title="Raspberry Pi" -d body='Raspberry Pi is up!'

exit 0

Restart your RPi

$ sudo reboot

You should get a notification that your RPi is up.


Setup Google Cloud Print on a Raspberry Pi

Google Cloud Print is a great service by Google that allows you to print to your printer from any device that supports the service.  In Google’s words:

Google Cloud Print is a new technology that connects your printers to the web. Using Google Cloud Print, you can make your home and work printers available to you and anyone you choose, from the applications you use every day. Google Cloud Print works on your phone, tablet, Chromebook, PC, and any other web-connected device you want to print from.

Image courtesy of Google’s Cloud Print Android app

The problem with the service is that you need either a computer that is running the service or a printer that supports it.  Since my Brother HL-2270DW laser printer – which is a phenomenal printer – does not support Cloud Print, I needed a computer on all of the time and that’s where the Raspberry Pi (RPi) comes in!  The beauty of the RPi is that it can always be running because of its low power consumption.

Because I’m running the RPi as a headless server, I needed to find a third party application/service that can use Cloud Print.  Dave Steele’s Cloudprint-service provides a nice service that runs in the background and can be installed and updated using his PPA repository.

Update 05/01/2016

A few things have changed with Google Cloudprint and Dave Steele has posted up to date directions here.

Continue reading

Reformat a Raspberry Pi SD Card Using Diskpart in Windows 7

In can be tricky reformatting a Raspberry Pi SD card in Windows 7 due to the multiple partitions that Raspian creates.  Here’s a simple way using the built in Diskpart in Windows 7.

Insert the SD card into an SD card reader and open a Windows command prompt console and start Diskpart.


List all of your disks.

DISKPART> list disk

Select your SD card disk.

DISKPART> select disk <#>

List all of your disks to ensure that the correct disk is selected – the selected disk will have an asterisk next to it.

DISKPART> list disk

Clean the disk.


Create a primary partition.

DISKPART> create partition primary

Create and format the primary filesystem.

DISKPART> format fs=fat32 quick

Assign the disk to a Windowsdrive letter so it shows up in Windows Explorer.

DISKPART> assign

Your disk is now ready for use.