This article will show you how to set up a print server on Linux Ubuntu 20.04 with CUPS.
What is CUPS
CUPS is a suite of programs that together provide a flexible, scalable printing system. It provides an easy to use, user friendly interface for creating and managing printers and has several different print functions, including server and client based printing.
CUPS was developed by Apple Inc. and support for CUPS in Linux has been growing steadily since version 1.1 in 1995. The latest stable release is 2.3.9 which supports a wide range of printers, including USB printers and networked printers.
Besides Linux, CUPS is also available on all major platforms, including Microsoft Windows, macOS, and Android.
The Advantages of CUPS
The advantages of CUPS are:
- CUPS is maintained by an open community of developers who continually improve and enhance it.
- It supports several printing backends: LPD/LPRng, Level Printer Spooler (LPR), and GPX.
- It is easy to use and configure.
- You can print a lot of different types of documents and images.
- CUPS supports both local and remote printing.
- It is compatible with most printers and scanners, including laser printers, inkjet printers, plotters, etc.
- It lets you manage all your print jobs easily from one place without having to visit each job folder separately.
Follow this post to learn how to Setup a Print Server on Linux Ubuntu 20.04 (CUPS).
How to Setup a Print Server on Linux Ubuntu 20.04 (CUPS)
Install CUPS Print Server on Ubuntu
Update your system to ensure all packages are updated.
sudo apt update
The Ubuntu Desktop edition is pre-installed with CUPS. Run the following command in your terminal to install CUPS on the Ubuntu server edition.
sudo apt install cups
Reading package lists... Done Building dependency tree Reading state information... Done cups is already the newest version (2.3.1-9ubuntu1.2). cups set to manually installed. …
Start and Enable CUPS service
Once CUPS is installed on your system, you need to start and enable the cups service on boot.
sudo systemctl start cups
Next, verify that the service is running as intended by checking the service status.
sudo systemctl status cups
● cups.service - CUPS Scheduler Loaded: loaded (/lib/systemd/system/cups.service; enabled; vendor preset: enable> Active: active (running) since Sat 2022-06-18 09:28:45 PDT; 13s left TriggeredBy: ● cups.path …
You can also enable the CUPS service to run on boot with the following command.
sudo systemctl enable cups
Synchronizing state of cups.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable cups
Setup and Configure the CUPS
Backup Configuration File
It is recommended to backup configuration files before making changes in case something goes wrong.
You can make a backup copy of the /etc/cups/cupsd.conf file using the following command.
sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.copy
Open and Edit the Configuration File
Open the /etc/cups/cupsd.conf file in the nano editor using the following command.
sudo nano /etc/cups/cupsd.conf
First, go to the Only listen for connections from the local machine section in the file and add the following line to specify 631 as the default port.
#Listen localhost:631 Port 631
Next, go to the Show shared printers on the local network section of the file and enable Browsing On. This will show shared printers on the local network.
Set BrowseLocalProtocols to dnssd protocol.
Now, go to the Restrict access to the server section and add Allow @LOCAL to allow access to other computers on the network.
#Restrict access to the server Order allow,deny Allow @LOCAL
Similarly, add Allow @LOCAL under the Restrict access to the admin pages section.
#Restrict access to the admin pages. Order allow,deny Allow @LOCAL
Press Ctrl+O and Ctrl+X to save and exit the file.
Restart the CUPS service for the changes to take effect.
sudo systemctl restart cups
Add User to lpadmin Group
It is advised to use either root or a user authorized in the lpadmin group if you want to set up via the CUPS web interface.
sudo usermod -aG lpadmin
Install Your Printer Driver
sudo apt install hplip
Install Bonjour for CUPS Printer Sharing
The Bonjour (DNSSD) protocol aids in making printing a network-discoverable service.
You can install avahi-daemon using the following command.
sudo apt install avahi-daemon
Then, start and enable the avahi-daemon service on boot with the following command.
sudo systemctl start avahi-daemon sudo systemctl enable avahi-daemon
Next, verify the avahi-daemon service by checking its status.
sudo systemctl status avahi-daemon
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack Loaded: loaded (/lib/systemd/system/avahi-daemon.service; enabled; vendor preset: enabl> Active: active (running) since Sat 2022-06-18 09:59:44 PDT; 2min 7s ago TriggeredBy: ● avahi-daemon.socket ...
Configure Firewall to Unblock Ports
You need to allow ports 631 and 5353 for cups and avahi-daemon respectively.
Run the following commands to unblock them.
sudo ufw allow 631/tcp sudo ufw allow 5353/udp
Add a Printer to Your System
Go to Settings > Printers and click on Add. You should see your printer under the Network Printer.
If you do not see it, provide the printer IP to manually add it.
Great job! We have learned how to Setup a Print Server on Linux Ubuntu 20.04 (CUPS).
How to Setup a Print Server on Linux Ubuntu 20.04 (CUPS) Conclusion
In this guide, we have shown you how to set up a CUPS print server on Linux Ubuntu 20.04.
CUPS, or the Common UNIX Printing System, is a printing system for UNIX-like operating systems. It’s an open source software package that aims to provide a standard printing solution.