Как открыть cups на linux

Сервер печати CUPS

Первичный (основной) механизм для печати и сервисов печати в Ubuntu — это Общая система печати UNIX (Common UNIX Printing System — CUPS). Данная система печати — это свободный, доступный и переносимый слой, который стал новым стандартом печати для большинства дистрибутивов Linux.

CUPS управляет заданиями печати и обеспечивает сетевую печать с использованием стандарта IPP (интернет протокол печати), поддерживая огромный список принтеров от матричных до лазерных и любых других. CUPS также поддерживает PostScript описание принтеров (PPD) и автоопределение сетевых принтеров, а также простую настройку и администрирование через web интерфейс.

Установка

Для установки CUPS на ваш Ubuntu компьютер просто используйте sudo для выполнения команды apt-get, передав ей названия пакетов в качестве параметра. Полная установка CUPS содержит много зависимостей, но они все могут быть определены в одной команде. Введите следующее в терминале для установки CUPS:

После аутентификации вас по паролю, пакеты должны загрузиться и установиться без ошибок. В заключении установки сервер CUPS будет запущен автоматически.

При необходимости решения проблем, вы можете получить доступ к ошибкам сервера CUPS через файл журнала /var/log/cups/error_log. Если журнал ошибок не дает достаточно информации для решения какой-либо проблемы, уровень журналирования CUPS можно повысить изменением директивы LogLevel в файле настроек (описывается ниже) до debug или даже debug2 со стандартного info, что будет сохранять в журнал абсолютно все. Если вы проведете такое изменение, не забудьте вернуть все обратно после решения проблемы, чтобы избежать излишнего разрастания файла журнала.

Настройка

Поведение сервера CUPS настраивается директивами, содержащимися в файле /etc/cups/cupsd.conf. Файл настроек CUPS использует тот же синтаксис, что и первичный айл конфигурации HTTP сервера Apache, поэтому пользователи, знакомые с редактированием файла настроек Apache смогут легко освоить настройки и файла CUPS. Здесь приведены некоторые примеры настроек, которые вы можете использовать, предварительно изменив.

Прежде чем редактировать файл настроек, вам стоит сделать копию оригинального файла и защитить ее от записи, чтобы у вас были оригинальные настройки в качестве руководства, которые можно восстановить при необходимости.

Скопируйте и защитите от записи файл /etc/cups/cupsd.conf.original с помощью следующих команд в терминале:

sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.original sudo chmod a-w /etc/cups/cupsd.conf.original

1. ServerAdmin: Для настройки email адреса назначенного администратора CUPS сервера, просто откройте на редактирование файл /etc/cups/cupsd.conf с помощью своего любимого текстового редактора, и добавьте или измените строку ServerAdmin соответствующим образом. Например, если вы администратор CUPS сервера и ваш email адрес ‘bjoy@somebigco.com’, вам следует изменить строку ServerAdmin следующим образом:

ServerAdmin bjoy@somebigco.com

2. Listen: В Ubuntu по умолчанию установленный CUPS сервер слушает только интерфейс обратной петли по адресу 127.0.0.1. Чтобы заставить CUPS сервер прослушивать актуальный IP адрес сетевого адаптера, вы должны указать сетевое имя или пару IP адрес/порт добавочной директивой Listen. Например, если ваш сервер находится в локальной сети с IP адресом 192.168.10.250 и вы хотите сделать его доступным для других систем в этой подсети, отредактируйте /etc/cups/cupsd.conf, добавив директиву Listen, как показано ниже:

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)

В приведенном примере вы можете закомментировать или удалить ссылки на адрес обратной петли (127.0.0.1), если вы не хотите, чтобы cupsd прослушивал этот интерфейс, а только Ethernet интерфейсы локальной сети. Чтобы разрешить прослушивать все сетевые интерфейсы, назначенные определенному сетевому имении, включая обратную петлю, вы можете создать такую запись Listen для имени (например) socrates:

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

или опустить директиву Listen и использовать вместо нее Port:

Port 631 # Listen on port 631 on all interfaces

Для дополнительных примеров по директивам в файле настройки CUPS, смотрите ассоциированную страницу системного руководства, введя в терминале следующую команду:

Читайте также:  Run mongodb on linux

Всякий раз, как вы внесли изменения в файл настроек /etc/cups/cupsd.conf, вам потребуется перезапустить сервер CUPS вводом следующей команды в терминале:

sudo /etc/init.d/cups restart

Web интерфейс

Настраивать CUPS и отслеживать его состояние можно через web интерфейс, который по умолчанию доступен по адресу http://localhost:631/admin. Web интерфейс можно использовать для выполнения любых задач управления принтером.

Чтобы выполнить административную задачу через web интерфейс, вы должны либо разрешить учетную запись root на своем сервере, либо авторизоваться как пользователь из группы lpadmin. По соображениям безопасности CUPS не авторизует пользователей с пустыми паролями.

Чтобы добавить пользователя в группу lpadmin, выполните в терминале следующую команду:

sudo usermod -aG lpadmin username

Дальнейшая документация доступна через закладку Documentation/Help web интерфейса.

Источник

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.

Читайте также:  Linux write bad file descriptor

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.

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.

Читайте также:  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