This comprehensive guide gives you the steps and the resources required to turn your Raspberry Pi into an always on, low power Google Cloud printing server.
Why? Having a Raspberry Pi as a print server not only allows a user to print from a mobile device but also allows for wireless printing through any network even if it is not shared by the Pi or the Printers.
If you are in an environment where printers are restricted or users are charged for use of the printer, this guide may also provide tips for getting around this.
Get your Pi to print.
First, we need to install CUPS (Common Unix Printing System).
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install cups
When prompted to continue press Y for “yes” and press enter. CUPS is a fairly large install so feel free to read ahead and get started on some of the other steps if you feel comfortable. Otherwise, go grab a coffee and settle in for the rest of this process.
CUPS has created a user group called “lpadmin” who has access to the print functions. We need to add ourselves to this group using:
sudo usermod -a -G lpadmin [user]
Put the username(s) you wish to give print access to in place of [user].
Great, now you have a working installation of CUPS on your Raspberry Pi. Next, we need to enable a web interface for adding new printers and such.
sudo nano /etc/cups/cupsd.conf
Look for:
# Only listen for connections from the local machine
Listen localhost:631
Comment out <code class=”language-xml”e>Listen localhost:631</code> and replace it with the following:
# Only listen for connections from the local machine
# Listen localhost:631
Port 631
This instructs CUPS to listen for any contact on any networking interface as long as it is directed at port 631.
Keep scrolling until you find the location settings. Modify this section so it looks like this:
< Location / >
# Restrict access to the server...
Order allow,deny
Allow all
< /Location >
< Location /admin >
# Restrict access to the admin pages...
Order allow,deny
Allow all
< /Location >
< Location /admin/conf >
AuthType Default
Require user @SYSTEM
# Restrict access to the configuration files...
Order allow,deny
Allow all
< /Location >
We’ve inserted “Allow all” into these fields to allow any computer access to CPUS on our Pi. Alternatively, you can use “Allow @local” to only allow computers on your local network, but in my environment, Google Cloud could not communicate to CUPS even when the printing device was on the same network. So I just set the permissions to “all”.
Anytime you make changes to the CUPS configuration, restart the CUPS for the changes to take effect.
sudo /etc/init.d/cups restart
Add a printer to CPUS
Open a web browser and navigate to [your Pi’s IP]:631 You should be greeted with the CUPS homepage. Navigate to the “Administration” tab…
and click “Add Printer”.
You will see a popup prompting you to login. Use the username you added earlier using lpadmin and the corresponding password.
From here, you can follow the prompts to add a local printer, discovered network printer, or configure your own network printer.
Adding a local printer and a discovered network printer is straightforward just follow the prompts (lucky dog!). However, adding your own network printer can be more difficult especially if CUPS does not recognize your printer protocol or drivers.
If all you have is an IP address for the printer then I would recommend using another Linux machine to add the printer using whatever built-in printing manager GUI come with your distro(I used Ubuntu). Then after the OS does its magic, finding protocols and installing drivers etc. look up the printer properties and transfer them to CUPS on your Raspberry Pi. For drivers, visit openprinters.org for a complete database of printer drivers for GNU/Linux.
Download the appropriate PPD and upload it to your Pi through CUPS.
While adding your printer make sure you check the “Share Printer” option as this allows Google Cloud to access it later. If you don’t check this option now you may have to delete the printer and add it again from scratch.
Finally, perform a test print and to ensure everything is working so far.
Google Cloud
While there are other ways to set up Google Cloud functionality on the Pi, installing Chromium is by far the easiest.
However, it isn’t painless.
Try:
sudo apt-get install chromium-browser
If this works for you congratulations! (lucky dog!)
If you get an error message attune to “sorry, this package doesn’t exist or has been renamed”, then you probably are running Raspbian Jessie which does not have official support for Chromium.
No worries! kusti8 of the Official Raspberry Pi Forums hosts the last working version of Chromium 45 on his dropbox for people like us to use. See his Guide on Installing Chromium on Jessie or continue following along here for the gist. Of course, if you would rather get Chromium from the official repos you are welcome to do so.
wget -c --tries=0 --read-timeout=20 https://dl.dropboxusercontent.com/u/87113035/chromium-browser-l10n_45.0.2454.85-0ubuntu0.15.04.1.1181_all.deb
wget -c --tries=0 --read-timeout=20 https://dl.dropboxusercontent.com/u/87113035/chromium-browser_45.0.2454.85-0ubuntu0.15.04.1.1181_armhf.deb
wget -c --tries=0 --read-timeout=20 https://dl.dropboxusercontent.com/u/87113035/chromium-codecs-ffmpeg-extra_45.0.2454.85-0ubuntu0.15.04.1.1181_armhf.deb
sudo dpkg -i chromium-codecs-ffmpeg-extra_45.0.2454.85-0ubuntu0.15.04.1.1181_armhf.deb
sudo dpkg -i chromium-browser-l10n_45.0.2454.85-0ubuntu0.15.04.1.1181_all.deb chromium-browser_45.0.2454.85-0ubuntu0.15.04.1.1181_armhf.deb
The -c --tries=0 --read-timeout=20
between wget and the URL are to force wget to retry the operation where it left off automatically should it time out or fail.
Using the code above, you should have downloaded the Chromium Browser packages and codecs and unpackaged and installed them.
Now you need some way to access your Pi’s desktop GUI. If you are unable to hook up a monitor look into installing a VNC for a virtual remote desktop server on the Pi.
Startup Chromium and log in using a Google account. For ease of use, you should use the same Google account you use on your other devices so that you automatically have permission to use the Google Cloud print service. however, it is possible to share printers on Google Cloud so any Google account will do.
Go to Chromium’s Settings.
Then to “advanced settings”
Navigate to Google Cloud Print and “Sign into Google Cloud Print” if you have done so already, simply click “Manage”
From here we will navigate to “Add a Classic Printer”
You should see the printers you added via CUPS here just add the printers to Google Cloud! Finally, perform a test print using Google Cloud Print and enjoy your always on, low-cost raspberry Pi print server.
Leave a Reply