DIY Print Server with a Raspberry Pi

I’ve had an old HP printer since college without wireless features. It works great, and I have a dragon’s hoard of ink for it. But, ever since I stopped using Windows, I have not had any luck installing the drivers for it on my MacBook. HP’s official support site doesn’t offer raw driver downloads, only a flakey setup wizard application. Over the last few years, my workaround has been to boot up my ancient Windows laptop, share files to it in one way or another, and then print from there. When I moved into a new house, it felt like a good time to make the printer work for my and my partner’s Macs, and why not make it wireless too? I’ve had a Raspberry Pi lying around unused for years that seemed fit for the job. In this post, I’ll walk you through how I set up a DIY print server with a Raspberry Pi.

Admittedly this post is intended for a very specific reader. But for that specific reader, I hope this walkthrough can save you a lot of the research I had to do. I’ve only attempted this configuration for my specific HP DeskJet. I imagine that, with just a little modification, it will work for any HP printer. A bit more effort might be able to adjust it for most makes and models.

What You’ll Need

First, of course, you’ll need a printer that isn’t properly installing drivers on your laptop. Mine is an HP DeskJet 1112. You’ll also need a Raspberry Pi, and almost any model will do. One that is wireless will be the most versatile, but as long as it’s network capable, it will work. I used a Raspberry Pi 3 Model B. I’ll assume that you’ve already set up your Raspberry Pi with an OS of your choice (Raspbian is fine). I configured mine to be in headless mode with SSH; that’s not strictly necessary but will prevent needing to plug in a monitor and peripherals for performing maintenance and troubleshooting.

Step 0: Physical Setup

Plug the Raspberry Pi and printer into wall power. You’ll also need to plug the printer into the Raspberry Pi. My printer is conveniently USB connected. Other types of connectors with adaptors may or may not work.

Step 1: Installing and Configuring CUPS

The Raspberry Pi is going to be running the Common Unix Print System (CUPS). Install it with the following commands.

> sudo apt update
> sudo apt install cups

You’ll need to add your user to the list of users that can print with CUPS. Unless you’ve explicitly changed the user, it will likely be the Raspberry Pi’s default “pi” user.

> sudo usermod -a -G lpadmin pi

Next, we’ll make the CUPS service accessible across the network with this command.

> sudo cupsctl --remote-any

Finally, we’ll disable CUPS’s default SSL so that we can use the CUPS GUI from a remote machine without fussing with SSL. With your favorite editor on the Raspberry Pi, modify “/etc/cups/cupsd.conf” to include the line “DefaultEncryption Never”. For this to take effect you’ll need to restart CUPS.

> sudo /etc/init.d/cupsys restart

Step 2: Installing Drivers

CUPS comes with many modern drivers pre-installed, so you may want to skip this step and come back only if the defaults don’t work for you. I found a great way to install older HP drivers. I’m not sure how to accomplish this for other printer manufacturers, but if you’re not using an HP, you should be looking for a “.ppd” file that corresponds with your make and model.

If you’re using an HP printer, try the HP Linux Imaging and Printing library that I found. It can be installed onto the Raspberry Pi along with a collection of “.ppd” files using the first two of the following commands. The last command runs the setup utility, it will ask for some basic information. Follow the prompts when requested.

> sudo apt-get install hplip
> sudo apt-get install hplip-ppds
> sudo hp-setup -i

Step 3: Verifying Setup with CUPS

From another laptop, you should now be able to access the CUPS GUI by using a browser to visit “raspberrypi.local:631”. Note that “raspberrypi.local” is the reserved hostname for Raspberry Pi and CUPS runs on port 631. Go to the “Printers” tab and verify that the printer you just set up is present in the list.

If you click on the printer, you can change some of the default options. For example, make sure that the printer is listed as “Shared.” If you’re based in the U.S., you will likely also want to reset the default media from A4 paper to Letter.

If the hp-setup utility failed or used an incorrect driver you may have to go through the manual “Add Printer” process. You can access this through the “Administration” tab. The process looks very similar, except you’ll have to select your own driver from the list. Most recent printers should be happy to use the HPCUPS drivers, but if it’s a slightly older model or HPCUPS isn’t working, then try an “hpijs” driver.

Step 4: Pointing the Laptop to CUPS server

The last step is to make sure that your laptop can recognize the CUPS server. On a Mac, you go to printer settings through System Preferences and add a new printer. Depending on your network configuration, it may already appear in the defaults and you can simply add it from there. Otherwise, you can manually add it on the IP tab. In the address field, enter “http://raspberrypi.local:631/printers/”. Click “Add” to complete the process. Try printing a test page and you should be all set.

DIY Print Server with a Raspberry Pi

This was an interesting project to research. I learned way more about printers than I ever anticipated needing to know. At the outset, I would have been happy to simply be able to print from my MacBook, but I’m thrilled that I was able to configure it wirelessly.