.. | ||
README.md |
Printer setup
In the modern world of linux, we use the CUPS printing system to interface with printers.
With modern printers, you usually don't even need drivers. This is known as "driverless printing".
Some older printers may need drivers in order for you to print to them, this will not be covered in this guide. The basic procedure is to look up the drivers for your printer and check if they are available in the repositories of your linux distribution. If you are unsure, you can install a group package with many drivers and hope that one of them works.
Installation
The first step is installing CUPS. The following instructions were performed on arch linux, but the procedure is roughly the same on other distrubtions. (refer to your local wiki!).
sudo pacman -S cups
If you want to be able to "print" to PDF documents, aka save to PDF via the print dialog, you can also install the following package:
sudo pacman -S cups-pdf
Then enable the CUPS service. You can either enable the service directly, or use socket activation.
A. Socket activation: only starts the service when a program needs it.
sudo systemctl enable cups.socket
B. Enable service: the CUPS service is always active, even when no program has requested it.
sudo systemctl enable --now cups.service
Configuration
Now that you have the printing service installed, you probably want to add some printers.
There are a few way of doing this. If your printer is parallel or USB, it should have been detected automatically (provided your system has the correct kernel modules loaded: lp, parport, parport_pc). You can manage your printers in the CUPS web interface.
CUPS web interface
By default, the CUPS configuration web interface can be accessed at http://localhost:631/admin/.
If you use socket activation, you might need to start the service first: sudo systemctl start cups.service
.
The interface is pretty self-explanatory. If something is unclear, you can read the CUPS Documentation.
Alternatively, there are multiple GUI Applications that can be used for configuration instead.
Adding network printers
If the address of the printer is known (and preferably static) you can add it manually via the web interface or a GUI application.
However, in most network environments you want to set up automatic discovery.
First, follow the steps in the HostnameResolution guide and come back once you have it set up.
After doing that, all you have to do is restart the CUPS service and hostname resolution should be working:
sudo systemctl restart cups.service
NOTE: If you want to share printer resources, or just interact with windows resources (SMB) in general, you can install the samba
package (arch linux):
sudo pacman -S samba
Setting up permissions
Normally only system administrators are allowed to manage things like printer queues.
You can add your usergroup to /etc/cups/cups-files.conf
, but this is not recommended.
Instead, you should configure policy kit to allow passwordless authentication for printer actions.
First, make sure you have policy kit set up. Follow the PolicyKit guide for that.
Then, create a policy kit rule: /etc/polkit-1/rules.d/49-allow-passwordless-printer-admin.rules
:
polkit.addRule(function(action, subject) {
if (action.id == "org.opensuse.cupspkhelper.mechanism.all-edit" &&
subject.isInGroup("wheel")){
return polkit.Result.YES;
}
});
And that is permissions set up!
Setting paper size
On arch linux, libpaper is installed with cups. If it wasn't installed, it is recommended to install it to be able to control paper configuration.
The arch package is libpaper
.
By default, libpaper uses the "Letter" paper size. If you don't want to change this every time you want to print something,
you can edit /etc/papersize
for systemwide configuration, and $USER/.config/papersize
for user-specific configuration.
To see available sizes, you can either view man 1 paper
or paper --no-size --all
.
Discovering printers on LDAP servers
In order to discover printers on LDAP servers, please follow "Adding network printers" and then enable cups-browsed.service
.