This follows the explanations from the sites below (see bottom) in more concentrated fashion.
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).
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.
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
Create a user (pi
) as printer admin
sudo adduser pi
sudo usermod -a -G lpadmin pi
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.
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
Finish configuration by rebooting so that every services gets freshly reloaded with the correct settings:
sudo reboot
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.