In this tutorial, we will show you how to install CUPS Print Server on Ubuntu 20.04 LTS. For those of you who didn’t know, CUPS (Common Unix Printing System) is the primary mechanism in the Unix-like operating system for printing and print services. It can allow a computer to act as a Print server.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the CUPS Print Server on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
Prerequisites
- A server running one of the following operating systems: Ubuntu 20.04, 18.04, and any other Debian-based distribution like Linux Mint or elementary OS.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install CUPS Print Server on Ubuntu 20.04 LTS Focal Fossa
Step 1. First, make sure that all your system packages are up-to-date by running the following apt
commands in the terminal.
sudo apt update sudo apt upgrade
Step 2. Installing CUPS Printer Server on Ubuntu 20.04.
CUPS is installed by default in the Ubuntu Desktop. To Install CUPS on the Ubuntu server enter the following command below:
sudo apt install cups
After installing the CUPS print server, start the CUPS print service in the following command:
sudo systemctl start cups sudo systemctl enable cups sudo systemctl status cups
Step 3. Configure CUPS on Ubuntu.
Now we edit the CUPS main configuration file:
sudo nano /etc/cups/cupsd.conf
First look for the line:
Browsing Off
Change that line to:
Browsing On
Next, find the “Only listen for connections from the local machine” section. Here, there will be an entry titled, “Listen localhost:631.” Change this to “Port 631,”:
#Listen localhost:631 Port 631
We also need to make sure that CUPS is listening on all interfaces. To do that, look for the section:
<Location /> Order allow,deny </Location>
Change the above section to:
<Location /> Order allow,deny Allow @LOCAL </Location>
Also, add it for the /admin
directory to allow remote administration from the local network:
<Location /admin> Order allow,deny </Location>
Change that section to:
<Location /admin> AuthType Default Require valid-user Order allow,deny Allow @LOCAL </Location>
Save and close the file. Then restart CUPS for the changes to take effect:
sudo systemctl restart cups
Once configured CUPS, we’re going to make sure the printer is shared out to your network using the Bonjour and IPP protocols. First, we need to install the avahi-daemon with the command below:
sudo apt install avahi-daemon
After installing the Avahi-daemon, start, and auto boot time using the following command:
sudo systemctl start avahi-daemon sudo systemctl enable avahi-daemon
Step 4. Configure Firewall.
If you have enabled a firewall make sure to allow the client’s machines to talk to CUPS port 631:
sudo ufw allow 631/tcp sudo ufw allow 5353/udp
Step 5. Connect to the Printer.
Now we add the printer will depend on the desktop operating system you are using. For example, with Ubuntu Linux, I can open up the Add Printer window from Settings | Devices and the new printer automatically appears.
At this point, your printer should be added to the desktop and able to print. Should you need to, you can manage both the printer and the server from the web-based console by pointing a browser to http://your-server-ip-addrees:631
. The admin console is at the address https://your-server-ip-address:631/admin
. For the admin console, you’ll be prompted for a valid username and password.
Congratulations! You have successfully installed CUPS. Thanks for using this tutorial for installing and setting up CUPS Print Server on Ubuntu 20.04 LTS Focal Fossa systems. For additional help or useful information, we recommend you check the official CUPS website.