Introduction: Minimal Raspberry Pi Google Cloud Print Server

I was cleaning up my electronic junk, and believe me I order a lot of stuff online and then lose track of it. Back in 2014 I ordered a Raspberry Pi, model B and it just came out of a box lying under some other boxes. It’s a wasted Rs. 2400.

I had initially planned it to be my media server, but then I bought a chromecast and DLNA compatible NAS server. So this was pretty much out of the equation. Moreover RPi are slow for File/Media servers. So let’s leave that for the solutions already available. I have an old deskjet 1050 AIO printer which is almost breathing it’s last breath. It’s really broken, with the outer body cracked and the I/O tray missing, but the thing still prints. So, if I were to buy a new printer then buying a Google Cloud Enabled printer would be a no brainer. But, it struck me, can I make this box online without much effort?

The complete setup took me less than an hour to complete and everything seems to be up and running smooth.

Step 1: Download Distro

I lost track of the RPi world long ago, a quick search revealed that a distribution called minibian is available and the developer is quite active with this. Please consider donating him. Head over here to download the latest image. At the time of writing it is March 12th update.

Step 2: Prepare SD Card

Just unzip the tar-gunzip package to get to the .img file and follow this guide here. Use this guide In case you’re running linux, use this guide.

Step 3: SSH

My windows laptop ran out of battery so I continued the setup from here on my chromebook. I plugged the sd card into the RPi, hooked it to a LAN cable from my wifi router, powered it on using a 5v 2amp charger. I had no idea about the lan address so a quick check into my wifi router’s DHCP tables revealed that 192.168.0.51 had been assigned to my RPi, so a simple ssh into ‘root@192.168.0.51’ with password ‘raspberry’ landed me the terminal with su access.

Step 4: Resizing the SD Card and Setting Up Locales.

Since, this is a minimal install, there is no GUI to do this, you might find steps to do this from terminal, but here is the easier way:

apt-get update; apt-get upgrade; apt-get install raspi-config;

Step 5: Configure RPi

run

raspi-config
and you get the RPi GUI for expanding the SD card and setting internationalization options. Do that and reboot.

Step 6: Install Nano

This step is optional, you might be comfortable with pico, but you can install the nano editor for quick editing files over ssh, nano works nice.

apt-get install nano

Step 7: Cups Web Printing

Cups stands for common unix printing system. This should support all printers from all manufacturers. Check with your manufacturer if the provide linux drivers, like HP does in a package called hplip. Follow this excellent guide. You can leave the scanner part for now, just follow all steps under the heading ‘Printing’.

Step 8: Google Cloud Printing Cups Connector

The folks at Google Cloud Print team has this great step by step guide to set the cups connector up and running in no time, however the code has bugs and it won’t run directly. I filed this as an issue with the team.

Step 9: Create a Google Group

head over to Google Groups to create a new group with your famil/friends with whom you would like to share the printer with, once done, get the groups email id. That would look something like your_group@googlegroups.com

Step 10: Correcting the GCP Config

while running the init script, you can respond with any gmail id. When all the steps are complete, before moving this to

/etc/gcp_cups_connector
dir. run:
nano ~/gcp-cups-connector.config.json
change scope to the google group email id you just created and continue with the guide from step 8.

Step 11: Setting Up Service to Start at Boot

This guide has 3 methods to do this, we need the first one. Since you are already logged in as ‘root’, you do not need to use sudo, you can run them without sudo. Also ideally the command

systemctl enable gcp
should make this start every time the system starts, but this won’t work as the network would be down at the start. So we need to make it retry till it finds the network. You can do
nano /etc/systemd/system/gcp.service
and make the file look like following (notice the restart and restart sec statements):
[Unit]
Description=Google Cloud Print CUPS Connector
Documentation="https://github.com/google/cups-connector/wiki/Systemd"
After=printer.target network.target multi-user.target

[Service]
ExecStart=/opt/gcp_cups_connector/gcp-cups-connector -config-filename /etc/gcp_cups_connector/gcp-cups-connector.config.json
Restart=always
RestartSec=5
User=gcp
Group=gcp

[Install]
WantedBy=multi-user.target

Step 12: Reboot and Wait

since you’re logged in as root, type reboot on the terminal and wait. Ideally, the printer would be listed at https://www.google.com/cloudprint/#printers now you can enjoy printing from your chromebook, phone or any machine connected to the internet.