Building a Raspberry Pi Print Server

I have an older laser printer, that has been a constant companion for me. It got me through graduate school, multiple moves, teaching … and is still my primary printer today. It’s over 20 years old, and I’ve been able to refurbish it and keep it running in tip-top shape. I have no interest in trading it in for a new printer or wifi-enabled printer. Sharing the printer via my Mac worked well enough for years, but it required the machine to be on, and it was becoming a pain for my wife and my son – who is now writing papers and completing school assignments that require the use of the printer.

As opposed to purchasing a new printer, I wanted to make use of a Raspberry PI to create a print server. I could keep it on all the time without worry, and it would provide a reliable connection to the printer. The following steps are the steps used to turn one of these tiny dynamos into a print server.

Materials

  • Raspberry Pi
  • Micro SD Card (For Pi OS)
  • Wi-Fi Connection (Or Wired Ethernet if Desired)
  • Your USB Printer(s)
  • Keyboard and Mouse

You can choose to do this without a mouse and keyboard (and monitor) if you choose if you’re more comfortable with tunneling into your Pi.

Raspberry Pi Os (Raspian)

Install the latest Raspberry Pi Os using your Micro SD card. You are able to install the OS using the Raspberry Pi Imager available for Windows, Mac OS and Linux. Simply open the application, insert your card, and select the appropriate Raspberry Pi OS for your version of the Pi. Once your Micro SD Card is ready, place it in the Raspberry Pi and start the machine.

To learn more about this step, please refer to the official Raspberry Pi Imager documentation.

Raspberry Pi OS is an accessible interface, that should look familiar to any Linux user. In addition, it closely resembles many earlier Windows versions. Once loaded your next steps will be to run some commands in the terminal.

1 – Perform Updates

Access the terminal, and type the following commands. These commands will update the Raspberry Pi OS to the latest version. When updating, you may be prompted to continue. In general, unless you have little space on your card, you may type “Y” to continue. This will likely take several minutes.

sudo apt update
sudo apt upgrade

2 – Install the Printing Software (CUPS)

We’re moving right along! We’re already at the point of installing the print server that will make your printer accessible on your network. We will be utilizing CUPS (Common Unix Printing System). CUPS is an industry-standard system that can be put to use by most operating systems and print servers. CUPS is licensed under the Apache License Version 2.0. Begin the installation using the terminal. Type the following:

sudo apt install cups

Note: Depending on the version of Pi OS you have installed (or other Linux flavor), there is a good chance CUPS is already installed. You may receive a message confirming its existence. If yes, do not remove the existing installation.

You will want to add the “Pi” user (generally the default user) to the lpadmin user list, so the account is permitted to print to CUPS.

sudo usermod -a -G lpadmin pi

To make CUPS available to all of your machines and your network, we will want to make it widely available by using the following command:

sudo cupsctl --remote-any

Restart CUPS to be assured our changes take place. After restarting we will access the user interface.

sudo systemctl restart cups

3 – Access the Pi Remotely

CUPS (Click to Enlarge)

You will want to be assured you have your Raspberry Pi IP address. If possible, you will want to reserve the IP for the Pi, so you can reliably use it as a printer server, and so you can reliably access the CUPS interface. Consult your router manual to determine how to reserve an IP address. Type your address in a browser on any machine on the network.

http://192.168.x.xxx:631. (With “x” being your local IP address values)

You should see the CUPS web interface after entering the URL.

4 – Samba

Assuming you will be using your machine with Windows, setting up Samba is likely required. To do so, you will need to first install Samba using the following command in the Terminal:

sudo apt-get install samba

Note: Depending on the version of Pi OS (or other Linux flavor) you have installed, there is a good chance Samba is already installed. You may receive a message confirming its existence. If yes, do not remove the existing installation.

You will want to make a few adjustments to the Samba configuration. Open /etc/samba/smb.conf using Nano or another preferred text editor.

sudo nano /etc/samba/samba.conf

Within samba.conf, you will be required to edit values in the # CUPS printing section of the form. Change values to be the following (guest ok = no to guest ok = yes):

guest ok = yes

In the Windows section, change to the following value (read only = yes to read only  = no):

read only  = no

Adding a Printer

CUPS (Click to Enlarge)

Adding a printer to CUPS is likely to be the easiest part of this tutorial. To begin, access the CUPS interface we tested previously using the proper URL. Click the “Administration” link at the top of the screen to access the printer admin tools.

1.) Be assured the printer is powered and is connected to the Raspberry Pi.

2.) Click the Add Printer Button

3.) Enter your username and password if prompted.

4.) You should be able to find your printer under the ‘Local Printers’ heading. Select the printer.

Add Printer (Click to Enlarge)

5.) On the next page, you may provide the name of the printer, and “human-readable” name. Be certain to select “Share This Printer” when saving.

6.) On the following pages, you may be prompted for a printer driver. Select the existing CUPS drivers, or upload a PPD file (Postscript Printer Description) if you have one. In most cases, older laser printers will work well with the generic selection, using a General PCL Laser driver. Printer options may be defined (if applicable) as well (e.g. duplexer).

The Final Step

Adding Via the Mac (Click to Enlarge)

Finally, you will want to be assured the printer can be found on networked machines, and that the printing works. Test this out by adding a network printer to your OS. Depending on the type of OS you are using (Mac, Windows, Linux) your steps may vary. On my Mac, the newly developed Pi Print Server is found.

Attribution: Raspberry Pi Board Photo by Harrison Broadbent on Unsplash