Printing service in linux

How to set up CUPS print server on Ubuntu 22.04

set up cups print server

W hen multiple computers are connected to the same network, connecting each computer with a separate printer is impossible. Also, it is crucial to manage the print requests and send them to the appropriate printer if there are multiple printers. For this purpose, Print Servers are used.

A print server is used to connect printers to the client’s computer. It can be a network device, an application, or a laptop. A print server’s job is to accept the print jobs, send them to appropriate printers, queue the jobs, count the pages, etc. It can manage hundreds of printers and is used in large companies and home offices.

On Unix-like operating systems, the primary mechanism for printing services is CUPS. CUPS stands for Common UNIX Printing System. It is a free, portable printing service widely used in most Linux distributions. It allows a computer to act as a print server that accepts print requests from multiple clients, manages the print jobs, and sends them to appropriate printers on the same network. It supports many printers and can be shared on the same network using different protocols. Let’s discuss how to install and configure the CUPS print server on Ubuntu 22.04.

Install CUPS print server

A CUPS print server can be installed on Ubuntu using the apt package manager. First, Update the system repositories by executing the following command in a terminal window:

update system repositories

Update system repositories

The CUPS comes pre-installed with Ubuntu. If it is not installed, install the CUPS print server by executing the following command:

Install CUPS

Wait till the installation completes. Once installed, we need to start the CUPS print service. To start the CUPS service, run the following command:

sudo systemctl start cups

start cups

To check whether the CUPS is installed and running, Execute the following command:

sudo systemctl status cups

cups status

To enable CUPS to auto-start on each boot, Execute the following command:

sudo systemctl enable cups

enable auto start cups at boot

Enable auto-start CUPS at boot

Configure CUPS print server

CUPS can be configured either from the terminal, i.e., editing the main configuration file (/etc/cups/cupsd.conf) of the CUPS print server, or through the web interface, which is available at http://localhost:631/admin.

Читайте также:  Rdp black screen linux

Configure via the command line

It is recommended that before editing the main configuration file, you should make a copy of the configuration file. If you made some mistakes while configuring the original file, you could undo the changes through the backup file. Execute the following command to make a copy of the configuration file:

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

create a backup file

Now, execute the following command to edit the configuration file of the CUPS print server. Here, we use a nano text editor, but you can choose any text editor.

sudo nano /etc/cups/cupsd.conf

edit the configuration file

edit the configuration file

    Locate “Browsing No” under the #show shared printers on the local network.

browsing no

browsing on

listen localhost

  • Locate “Listen localhost:631” under the #Only listen for connections from the local machine.

port 631

Change it to “Port 631”.

  • Now, locate the line #Restrict access to the server, which contains the following code:
server access

Add “Allow @LOCAL” in the above code:

 Order allow,deny Allow @LOCAL 
server access edited
admin access

Change the above code by adding the following lines:

 AuthType Default Require valid-user Order allow,deny Allow @LOCAL 
admin access edited

When changes are made, save the file by pressing Ctrl+S and exit by pressing Ctrl+X. Restart the CUPS service by executing the following command:

sudo systemctl restart cups

restart cups

Configure via the GUI

The CUPS print server can also be configured from the web interface, which runs on port 631 and is available at http://localhost:631/. The web interface can be used to monitor and perform all printing jobs. You can add and manage printers, print jobs, and edit the configuration file directly from the interface. All these services are available under the Administration tab.

Navigate to http://localhost:631 / to open the CUPS web interface. You can find the documentation and references to using CUPS on the homepage for users, administrators, and developers.

cups web interface

It requires root permission to perform the administrative tasks. Enter your root login details when prompted.

Administration tab

If the above step doesn’t work, CUPS does not authenticate a user without a password. You can add a user to the lpadmin group by executing the following command:

Now, Click on “Add a printer,” select your printer from the options, and click continue.

choose a printer

Choose your printer model, and enter the name and other information. The printer will be added successfully.

Sharing the printer through Bonjour

Bonjour consists of Multicast-DNS (mDNS) and DNS-based Service Discovery (DNS-SD), which enables the discovery of devices and services on a local network via the IPP protocol. The Internet printing protocol (IPP) is used for communication between client devices and printers. It allows the clients to use the shared printers without installing any drivers.

browseprotocols dnssd

Ubuntu 22.04 is already set to use the Bonjour protocol(DNSSD) for sharing the printer over the local network.

Use CUPS print server on the client’s computer

Most Linux distributions have the CUPS as the default printing system. It will be able to automatically detect the printer and use it on the same network. If your system cannot see the print server, You can manually add the CUPS print server from the Settings.

Читайте также:  Wo mic linux install

Open the Settings application through the app drawer or search bar—select Printers from the left pane.

Click on Add a printer button to add a new printer. The CUPS print server will be mentioned. Select the printer and click on Add button.

add a printer

That’s all! The CUPS print server has been added to your client’s device. As shown below, the printer is ready, and there are no active jobs.

cups printer

While printing, any files will be shown in the list on selection, and the print server will send the print request to the appropriate printer. If multiple devices send the print request, it will queue the print jobs and print them accordingly.

If your system didn’t find the printer, the ippfind command is not installed on your system. To install the ippfind command, Execute the following command:

sudo apt install cups-ipp-utils

Now, restart the CUPS service by running the following command:

sudo systemctl restart cups

Conclusion

We covered both the ways of setting up a CUPS print server and adding it to the client’s system. If you think we missed something, let us know in the comment section below.

Источник

Set up CUPS Print Server in Ubuntu 20.04

The job of a print server is to accept print requests from multiple machines, process those requests, and then send them to the specified printer for serving those requests. CUPS is a utility designed for Linux operating systems that can turn a regular computer system into a print server. This article provides a method for setting up the CUPS print server in Ubuntu 20.04.

Method for Setting up CUPS Print Server in Ubuntu 20.04

To set up the CUPS print server in Ubuntu 20.04, follow the steps listed below:

Step 1: Install CUPS Print Server

To install the CUPS print server, you will need to give the installation command via the terminal. Launch the terminal, as shown in the following image:

Once the terminal has been launched, you can install the CUPS print server by running the command listed below:

The installation of the CUPS print server will take around two to three minutes with moderate Internet speed. Once the installation process is complete, you should see the following output in the terminal:

Step 2: Start CUPS Print Service

After installing the CUPS print server, start the CUPS print service in the following manner:

Running the above command in your terminal will immediately start the CUPS print service.

Step 3: Enable CUPS Print Service

The next step is to enable the CUPS print service that you have just started, which can be done by executing the command shown below in the terminal:

Читайте также:  Локальная сеть между linux windows

Once your system has successfully started the CUPS print service, it will signal your terminal to display the following output:

Step 4: Configure CUPS Print Server

To configure the CUPS print server, open its configuration file with any text editor of your choice (preferably the nano editor, since it is the default text editor of Linux). Then, configure the CUPS print server by running the following command in the terminal:

The configuration file of the CUPS print server is shown in the image below:

Scroll down and find the “Show shared printers on the local network” section. Here, you will find an entry titled, “Browsing Off.” Change this to “Browsing On,” as shown in the following image:

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,” as shown in the image below:

Now, find the “Restrict access to the server” section and add the line “Allow @LOCAL” after the line “Order allow, deny,” as shown in the following image:

Finally, find the “Restrict access to the admin pages” section and make the necessary modifications in this section, as shown in the image below:

Finally, save the CUPS print server’s configuration file and exit from the text editor by pressing Ctrl + X.

Step 5: Restart CUPS Print Service

After making these changes in the configuration file, restart the CUPS print service that you previously started by running the following command:

Running this command will restart the CUPS print service with the new configurations in place.

Step 6: Verify Successful Setup of CUPS Print Server

To verify whether the CUPS print server has been set up successfully on your Ubuntu 20.04 system, type “printer” in the Activities search bar, and then select the “Printer Settings” option from the results, as highlighted in the image below:

Click on the “Add” button in the “Printer Settings” window, as highlighted in the following image:

You should be able to see the CUPS Printer in the entries if you do not have any other printer attached to your system. This will be an indication that the CUPS print server has been successfully installed on your system, as shown in the image below:

Conclusion

This article explained the step-by-step procedure of setting up a CUPS print server in Ubuntu 20.04. After following these steps, your Ubuntu 20.04 system will be all set to act as a full-fledged print server.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.

Источник

Оцените статью
Adblock
detector