Skip to content

Instantly share code, notes, and snippets.

@KageKirin
Last active December 4, 2022 21:35
Show Gist options
  • Save KageKirin/f6c599d0e6f88e82efa9aa4d290224d8 to your computer and use it in GitHub Desktop.
Save KageKirin/f6c599d0e6f88e82efa9aa4d290224d8 to your computer and use it in GitHub Desktop.
Raspi as AirPrint capable print server -- Setup guide

Raspi as AirPrint capable print server -- Setup guide

This follows the explanations from the sites below (see bottom) in more concentrated fashion.

Before Starting

REMINDER double check your printer is actually supported by CUPS out-of-the-box, or that the Linux drivers are available for ARM64 processors. A number of printer makers DO NOT have drivers for Linux/ARM64. (I see you, Brother!)

In the latter case, this guide might still be valuable, but you have to install a Debian/Ubuntu Linux on a x86_64 PC/NUC instead of Raspbian on a Raspi. (For other Linux distros, just use your the related package manager to install the same packages).

Starter: Raspbian 64bit NO GUI

We start with Raspbian (here: Bullseye), 64bit, no desktop environment. This is NOT the default selection in the SDcard flashing tool

YMMV if you need specific printer drivers that do not support aarch64 (ARM 64 bit).

Important: provide the initial network (WiFi) and SSH credentials so we can SSH into the machine right from the start.

Packages to APT install

Refresh the packages

sudo apt update
sudo apt upgrade

Install CUPS, Samba and Avahi-daemon (Bonjour support)

sudo apt install cups samba avahi-daemon
sudo apt install xinetd cups-ipp-utils printer-driver-cups-pdf ## might be required for more ecletic printers

Finally upgrade everything

sudo apt full-upgrade

User configuration

Create a user (pi) as printer admin

sudo adduser pi
sudo usermod -a -G lpadmin pi

Specific configuration

CUPS

Setup CUPS and allow any remote connection (should be fine for home network, right?)

sudo cupsctl --remote-any
sudo systemctl restart cups

Get yout IP

hostname -I

Open up the address with port 631 in a webserver, e.g. http://192.168.0.60:631/ and add a printer from the selection.

If your printer type is not listed, it gets annoying.

SAMBA

Configure your Samba share for the printer, then restart the Samba daemon

sudo nano /etc/samba/smb.conf
sudo systemctl restart smbd

Add the following to /etc/samba/smb.conf

[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700

[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no

Finally

Finish configuration by rebooting so that every services gets freshly reloaded with the correct settings:

sudo reboot

References

PiMyLifeUp -- Setting up an AirPrint Server on your Raspberry Pi
PiMyLifeUp -- Raspberry Pi Print Server: Setup a Network Printer

Raspberrypi.com -- Printing at home from your Raspberry Pi

Developer.com -- CUPS and Raspberry Pi AirPrinting

Medium.com -- Printing and scanning from a distance with Raspberry Pi and your old USB printer.

Github.com -- Raspberry-Pi-as-a-Printer-Scanner-Server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment