How to Install CUPS Print Server on Ubuntu Linux

laptop 5437167 640

This post shows students and new users steps to setup CUPS print server on Ubuntu Linux. CUPS allows a computer to act as a Print server. It provides mechanism on the Unix-like operating system for printing and print services.

In environments with multiple printers, one can use CUPS print server to handle and manage print jobs. CUPS supports printing, queueing, network printing (using IPP), supports for large range of printers, network printers auto-detection, web administration, and more.

For businesses and individuals looking for affordable print server, CUPS should be considered especially when large printers are involved. And if you need help installing and configuring CUPS, the steps below will show you how to do that.

Also, for students and new users learning Linux, the easiest place to start learning is on Ubuntu Linux. Ubuntu is the modern, open source Linux operating system for desktop, servers and other devices.

To get started with installing and configuring CUPS on Ubuntu Linux, follow the steps below.

How to install CUPS on Ubuntu Linux

As mentioned above, CUPS can turn any Unix-like operating systems, including Ubuntu into a print server. CUPS packages are including in Ubuntu repositories by default, and the installation is pretty straightforward.

To install CUPS on Ubuntu, run the commands below.

sudo apt update
sudo apt install cups

Once CUPS is installed, the commands below can be used to stop, start and enable CUPS service to automatically start up when the server boots.

sudo systemctl stop cups
sudo systemctl start cups
sudo systemctl enable cups

To verify that CUPS is installed and running, run the commands below.

sudo systemctl status cups

You should then see similar output as below:

cups.service - CUPS Scheduler
     Loaded: loaded (/lib/systemd/system/cups.service; enabled; vendor preset: >
     Active: active (running) since Sat 2021-10-16 14:15:03 CDT; 2min 36s ago
TriggeredBy: ● cups.socket
             ● cups.path
       Docs: man:cupsd(8)
   Main PID: 664 (cupsd)
      Tasks: 1 (limit: 4651)
     Memory: 2.3M
     CGroup: /system.slice/cups.service
             └─664 /usr/sbin/cupsd -l

Oct 16 14:15:03 ubuntu2004 systemd[1]: Started CUPS Scheduler.

How to configure CUPS on Ubuntu Linux

After installing CUPS above, you can configure CUPS its web interface at http://localhost:631/admin.

ubuntu cups web interface

If you prefer to use the command line interface, CUPS configuration file is located at /etc/cups/cupsd.conf.

When using the commands line to configure CUPS, run the commands below to create a backup copy of the configuration file.

sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.original

Then run the commands below to open CUPS configuration file.

sudo nano /etc/cups/cupsd.conf

You can then begin configuring settings that suit your environment.

By default, CUPS listens on port 631.

# Only listen for connections from the local machine.
Listen localhost:631
Listen /run/cups/cups.sock

You can also make sure browsing is enabled to allow CUPS to make shared printers available on the network.

Set the directive below to to dnsd protocol (that supports Bonjour), by default it is enabled.

# Show shared printers on the local network.
Browsing On
BrowseLocalProtocols dnssd

CUPS also restricts access to the printer server web interface and admin pages using the directives below. You can add Allow @LOCAL to allow computers from the local network to access CUPS web interface.

#Restrict access to the server
<Location />
 Order allow,deny
Allow @LOCAL
<Location>

#Restrict access to the admin pages.
<Location /admin>
Order allow,deny
Allow @LOCAL
<Location>

If you prefer to configure using CUPS web interface, it’s recommended to use either root or a user authenticated in the lpadmin group.

To add a user to lpadmin group, type:

sudo usermod -aG lpadmin username

Replace username with the account you want to add to the lpadmin group.

When you’re done, run the commands below to restart CUPS.

sudo systemctl restart cups

How to install printer drivers on Ubuntu Linux

Most HP printers support Linux systems, including Ubuntu. However, installing  HP’s Linux Imaging and Printing software (HPLIP) won’t hurt.

Run the commands below to install hplip on Ubuntu.

sudo apt install hplip

For CUPS to publish shared printer, you may need to install avahi-daemon. avahi-daemon is a Bonjour server that will broadcast your computer’s information on the network.

sudo apt install avahi-daemon
sudo systemctl start avahi-daemon

If you have firewall enabled, you also also need to allow CUPS traffic through the firewall. You can run the commands below to enable CUPS through Ubuntu firewall.

sudo ufw allow 631/tcp
sudo ufw allow 5353/udp

How to add printer on Ubuntu Linux

Now that CUPS is installed and configure, logon to your Ubuntu machine and browse the CUPS print server and access any shared printers.

Below we showed you how to install printers on Ubuntu Linux. Reference the post below to learn how to add printer to Ubuntu.

How to add printers to Ubuntu Linux

ubuntu install printer via cups

That should do it!

Conclusion:

This post showed you how to install and configure CUPS on Ubuntu Linux. If you find any error above or have something to add, please use the comment form below.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.