When I switched to Chromebook as my primary computer one thing I wasn’t so happy about was printing. I had to keep another Windows machine running and share its printing via Google cloud print service. As a Chromebook user I want to get rid of Windows and don’t like the idea of booting up the machine every time I want to print. Well, thanks to Raspberry Pi and Google CUPS connector I now can build a Google cloud print server box which I can leave it on all the time.
Basically the steps involved are setup Raspberry Pi to boot up Arch Linux, install CUPS, hook up the printer and load driver, and then add Google CUPS connector.
The hardware setup
- One Raspberry Pi2 board.
- Power adapter for your Rasberry Pi 2.
- One microSD card at least 2GB.
- Your printer connect to Rasberry Pi 2 USB slot.
- Network cable from Rasberry Pi to your router.
The software setup
Install Arch Linux
Visit http://archlinuxarm.org/. Click on Platforms/ARMV7/Broadcom/Raspberry PI 2. Here the current direct link.
Click on Installation tab and follow the instruction there. If you can’t run mkfs.vfat and mkfs.ext4 command, install dosfstools.
sudo apt-get install dosfstools
Notice I’m using Arch Linux but you can use any other OS, like Raspbian. Just change the ArchLinux’s “pacman” commands you see to equivalent package installation command like “apt-get install”.
Remove the micro SD card from your host and insert it into the Raspberry Pi 2 box. Insert ethernet cable, and USB power to power it on. Run this command at your Ubuntu terminal to ssh in your Raspberry Pi box. If you don’t have an Unbutu terminal you can use a Mac or Windows to ssh into the Raspberry Pi machine. Or if you only have a Chromebook you can either install Ubuntu with crouton script or install the Secure Shell application. Easiest is to install the Secure Shell application.
Replace the IP with whatever the IP assigned by your router. Enter “alarm” for password.
Get into root by run su command and use “root” for password.
First update the installed packages with
Then install CUPS with
pacman -S cups ghostscript
Hit enter and y to choose default and proceed with cups installation.
Start up CUPS and see if its working.
systemctl start org.cups.cupsd.service
Now you need to modify cups configuration file so you be able to remotely log in CUPS web interface.
And modify the file to add these hi-lighted lines.
123567891112131416# Only listen for connections from the local machine.#Listen localhost:631Listen /var/run/cups/cups.sock<Location /># Restrict access to the server...Order allow,deny</Location><Location /admin># Restrict access to the admin pages...Order allow,deny
systemctl restart org.cups.cupsd.service
Open a browser in another tab and log in CUPS web interface and see if it works. Use the same IP as SSH session above but add port 631.
Go ahead and enable CUPS to start on every boot with
systemctl enable org.cups.cupsd.service
Install the printer driver
Back to the browser with the CUPS web interface, click Administration and then Add Printer tabs. Your printer should be listed under Local Printers or Network Printers. Click on the bubble on the connected printer and hit Continue. On next screens choose the Make and Model of your printer from the default CUPS driver. If the driver is not available you can download the PPD file from http://www.openprinting.org/printers. At openprinting website, enter Manufactuer and Model and download the PPD file to your host machine.
Sometime the recommended driver is not really working. You can look through users comments and see if they recommend a better driver listed under Other drivers. Like in my case, the website recommends hpijs-pcl5e driver but hl1250 ends up as better driver for the Brother HL-2170W printer.
Anyhow, click Choose File button and load the PPD file you just download from openprinting.org. Hit Add Printer button to continue. After the driver is installed, print the test page by click on Manage Printers, click on the printer under Queue Name, then click on Maintenance and Print Test Page.
Install Google CUPS connector
First install the required Avahi package
12345pacman -S avahisystemctl start avahi-daemon.servicesystemctl enable avahi-daemon.service
Currently there is no Google CUPS connector binary available for Raspberry Pi on Arch Linux. So you have the option of building the google-cup-connector binary from the scratch by following the instruction at https://github.com/google/cups-connector/wiki/Install. Or you can can download the binary I already built and here are the instructions.
Back to the terminal with ssh session. First make sure you are in root. Run su and use “root” if not. Then run these commands to download the binary and the service unit for systemd.
1234567cd /usr/bincurl -e vietcali.com -o gcp-cups-connector http://vietcali.com/download.php?f=gcp-cups-connector-rpi2-arch.binchmod +x gcp-cups-connectorcd /etc/systemd/systemcurl -e vietcali.com -o gcp.service http://www.vietcali.com/download.php?f=gcp.service.txt
Then enable and start the google cloud print connector via systemd.
1234systemctl start gcpsystemctl enable gcp
Your printer should now be recognized in your Chromebook. To test, hit Ctrl-P in Chrome browser and choose the printer, and print.