Сервер печати на линукс

CUPS — Print Server

The primary mechanism for Ubuntu printing and print services is the Common UNIX Printing System (CUPS). This printing system is a freely available, portable printing layer which has become the new standard for printing in most Linux distributions.

CUPS manages print jobs and queues and provides network printing using the standard Internet Printing Protocol (IPP), while offering support for a very large range of printers, from dot-matrix to laser and many in between. CUPS also supports PostScript Printer Description (PPD) and auto-detection of network printers, and features a simple web-based configuration and administration tool.

Installation

To install CUPS on your Ubuntu computer, simply use sudo with the apt command and give the packages to install as the first parameter. A complete CUPS install has many package dependencies, but they may all be specified on the same command line. Enter the following at a terminal prompt to install CUPS:

Upon authenticating with your user password, the packages should be downloaded and installed without error. Upon the conclusion of installation, the CUPS server will be started automatically.

For troubleshooting purposes, you can access CUPS server errors via the error log file at: /var/log/cups/error_log . If the error log does not show enough information to troubleshoot any problems you encounter, the verbosity of the CUPS log can be increased by changing the LogLevel directive in the configuration file (discussed below) to “debug” or even “debug2”, which logs everything, from the default of “info”. If you make this change, remember to change it back once you’ve solved your problem, to prevent the log file from becoming overly large.

Configuration

The Common UNIX Printing System server’s behavior is configured through the directives contained in the file /etc/cups/cupsd.conf . The CUPS configuration file follows the same syntax as the primary configuration file for the Apache HTTP server, so users familiar with editing Apache’s configuration file should feel at ease when editing the CUPS configuration file. Some examples of settings you may wish to change initially will be presented here.

Tip

Prior to editing the configuration file, you should make a copy of the original file and protect it from writing, so you will have the original settings as a reference, and to reuse as necessary.

Copy the /etc/cups/cupsd.conf file and protect it from writing with the following commands, issued at a terminal prompt:

sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.original sudo chmod a-w /etc/cups/cupsd.conf.original 
  • ServerAdmin: To configure the email address of the designated administrator of the CUPS server, simply edit the /etc/cups/cupsd.conf configuration file with your preferred text editor, and add or modify the ServerAdmin line accordingly. For example, if you are the Administrator for the CUPS server, and your e-mail address is ‘bjoy@somebigco.com’, then you would modify the ServerAdmin line to appear as such:
ServerAdmin bjoy@somebigco.com 
Listen 127.0.0.1:631 # existing loopback Listen Listen /var/run/cups/cups.sock # existing socket Listen Listen 192.168.10.250:631 # Listen on the LAN interface, Port 631 (IPP) 

In the example above, you may comment out or remove the reference to the Loopback address (127.0.0.1) if you do not wish cupsd to listen on that interface, but would rather have it only listen on the Ethernet interfaces of the Local Area Network (LAN). To enable listening for all network interfaces for which a certain hostname is bound, including the Loopback, you could create a Listen entry for the hostname socrates as such:

Listen socrates:631 # Listen on all interfaces for the hostname 'socrates' 
Port 631 # Listen on port 631 on all interfaces 

For more examples of configuration directives in the CUPS server configuration file, view the associated system manual page by entering the following command at a terminal prompt:

Note

Whenever you make changes to the /etc/cups/cupsd.conf configuration file, you’ll need to restart the CUPS server by typing the following command at a terminal prompt:

sudo systemctl restart cups.service 

Web Interface

Tip

CUPS can be configured and monitored using a web interface, which by default is available at http://localhost:631/admin . The web interface can be used to perform all printer management tasks.

In order to perform administrative tasks via the web interface, you must either have the root account enabled on your server, or authenticate as a user in the lpadmin group. For security reasons, CUPS won’t authenticate a user that doesn’t have a password.

Читайте также:  Все об astra linux common edition

To add a user to the lpadmin group, run at the terminal prompt:

sudo usermod -aG lpadmin username 

Further documentation is available in the Documentation/Help tab of the web interface.

Источник

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:

Читайте также:  Запуск графической оболочки linux ubuntu

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.

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.

Читайте также:  Android transfer files usb linux

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.

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.

Источник

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