Printing on Linux 101
The basics
What is CUPS
OpenPrinting CUPS
The current standards-based, open source printing system developed by OpenPrinting for Linux® and other Unix®-like operating systems. CUPS uses IPP Everywhere™ to support printing to local and network printers.
CUPS is used in Apple’s iOS and macOS as well, though it is a slightly different version.
CUPS supports printing to
- AirPrint™ and IPP Everywhere™ printers (which is supported by most modern printers)
- Network and local (USB) printers with Printer Applications
- Network and local (USB) printers with (legacy) PPD-based printer drivers
In this article, we’ll use AirPrint™/IPP Everywhere™ printers as well as HP’s poop legacy printer.
IPP Everywhere
IPP everywhere is a PWG standard that allows personal computers and mobile devices to find and print to networked and USB printers without using vendor-specific software.
Setting Up
mDNS
mDNS stands for Multicast DNS. It acts as a protocol which resolves hostnames to IP addresses within small networks that do not include a local name server. The main selling point of it is zeroconf(zero configuration needed). Which is great to discover printers without user’s manual interaction.
systemd-resolved
It is recommended to disable systemd-resolved’s mDNS function to avoid any conflict. This configuration example is from the moeOS project:
1 | /usr/lib/systemd/resolved.conf.d/moeOS-avahi-compact.conf |
When done, restart systemd-resolved.
Avahi
Avahi can be found and installed on most distros, which acts as a mDNS resolver and zeroconf discovery service.
To enable it, execute:
1 | systemctl enable --now avahi-daemon |
CUPS
CUPS and other dependencies should be installed:
1 | cups |
After installation, several services and sockets should be enabled using:
1 | systemctl enable --now cups cups-browsed |
Installing the printer
AirPrint™ & IPP Everywhere™
By default, AirPrint™ & IPP Everywhere™ printers should be detected and installed automatically in a DE (GNOME and Cinnamon tested). Head to the printer settings, the printer should be shown if nothing goes wrong.
HP specific setup (Legacy)
Although most printers support AirPrint™ & IPP Everywhere™, some legacy printers may still need a driver to be installed. This is when hplip
and hplip-plugin
come in. At the time writing, I’m not exactly sure whether HPLIP and its plugins are proprietary. Avoid it if you can.
hplip-plugin
andhplip
needs to be installed before setting up the printer.- Head to CUPS Web Interface to add your printer and select the correct driver.