Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

This guide shows you how to share a printer connected to a CentOS 8/RHEL 8 computer with Windows, MacOS and iOS clients on the same network. CUPS (Common Unix Printing System) – The standard printing system for Linux, FreeBSD and MacOS. There may be a special utility to install a printer in the Linux desktop environment, but they all use CUPS under the hood. A CUPS printer can be shared over a network using various protocols, including the following:

  • Hello + IPP : Bonjour, also known as mDNS/DNS-SD (Multicast DNS/DNS services detection), enables a computer to find services on a local network. IPP (Internet Printing Protocol) – transport protocol.
  • SMB: also known as Samba, is mainly used to share files and printers with Windows clients.
  • AirPrint : Allows iPhone, iPad and MacOS clients to print over Wi-Fi.

Each protocol has its advantages and disadvantages. Let me first show you how to install and configure CUPS. We will then learn how to share a CUPS printer using the 3 protocols mentioned above. I recommend using all three methods to share a printer, so that users can find an available printer on the local network with a minimum of effort.

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

Step 1: Installation and setup of BCCs on CentOS 8/RHEL 8

CUPS is pre-installed on the desktop version of CentOS 8/RHEL 8. If you are using the server version of CentOS 8/RHEL 8, run the following command to install CUPS from the default CentOS 8/RHEL 8 repository.

sudo dnf installation goggles

Then start the CUPS.

sudo systemctl starter kit

Activate automatic start during charging.

sudo systemctl enabling savings

Check his condition:

System status log

Taking samples:

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

Then edit the main file of the CUPS configuration with a command line text editor such as Nano.

sudo nano /etc/cups/cupsd.conf

By default, the CUPS web interface is only available on localhost:631. If you are using the server version of CentOS 8/RHEL 8, you can force CUPS to listen to all available network interfaces to access the CUPS web interface from other computers. Find the next line.

Listen to the man on the ground: 631

Adjust it so that CUPS listens on all network interfaces.

Connection 631

The following line of CUPS shows the shared printers on your local network so that other computers on the same network can see the printers connected to your CentOS 8/RHEL 8 computer.

See

Then search in the following lines.

Allow the order, refuse the order

The above configuration only allows access to the CUPS web interface from the local host. To allow access from other computers on the same network, add @LOCAL to the configuration as shown below.

Authorisation to order, refusal
Authorisation granted @LOCK

If you want to allow remote management from the local network, add this for the /admin directory.

Authorisation to order, refusal
Authorisation granted @LOCK

Save the file and close it. Then restart CUPS to make the changes take effect.

restart sudo systemctl cups

We need to give clients on the same network access to port 631 on your CentOS 8/RHEL 8 computer.

sudo firewall-cmd –permanent –add-port=631/tcp

Restart the firewall to allow the change to take effect.

Restart sudo systemctl firewall

In addition to the main cups.service, there is the cups-browsed.service, which can be used to scan and add a printer from the local network. If you want your CentOS 8/RHEL 8 computer to be able to use other printers on your local network, start this service.

carved eyebrows

And activate the automatic start during charging.

sudo systemctl eyebrow tube recording

Step 2: Install the Printer Driver on CentOS 8/RHEL 8.

The driver must be installed on CentOS 8/RHEL 8 to recognize and use the printer. If you have an HP printer, you can easily install the driver with the following command.

sudo dnf installation hplip

I also recommend installing the gutenprint-cup package, which contains the CUPS drivers for Canon, Epson, HP and compatible printers.

sudo dnf installation gutenprint-cups

If you have other printers, you can find drivers at openprinting.org.

After installing the driver, you may need to reconnect the printer to the USB port of your CentOS 8/RHEL 8 computer. Under CentOS 8/RHEL 8 you can create a text file to check if the driver is working properly:

LinuxBabe is fantastic! > .txt file

Then run the following command to print this text file from the command line.

lp-file.txt

It’s a very primitive method, so don’t worry about the quality of the seal.

Step 3: sharing CUPS printers using Bonjour/IPP protocol

Awahi daemon installation

CUPS can announce its presence on the network via the mDNS (multicast DNS) and DNS-SD (DNS Service Discovery) protocols, also known as Bonjour. To do this, install and run avahi-daemon, a service similar to Apple’s Bonjour service, which allows computers to automatically discover shared devices and services on a local network.

install sudo dnf avahi

We also need to install the nss-mdns package from the EPEL repository, which is necessary for customers to resolve the .local domain on the network.

Install sudo dnf epel-release

install sudo dnf nss-mdns

Launch the demon Avahi.

sudo systemctl start avahi-daemon

Activate automatic start during charging.

sudo systemctl Turn on the demon avahi.

The Avahi daemon listens on UDP port 5353. Open it in the firewall.

sudo firewall-cmd –permanent –add-port=5353/udp

Restart the firewall to allow the change to take effect.

Restart sudo systemctl firewall

Driverless IPP Printing

Bonjour is used to promote the printer on your local network. The Internet Printing Protocol (IPP) is necessary for the CUPS clients and server to communicate with each other. The advantage of PIP is that customers can use a shared printer without having to install a driver on their own devices. CUPS supports out-of-box PIP, so you don’t have to do anything else to share a CUPS printer via PIP.

Step 4: Adding printers to client computers

MacOS and Linux clients

Since the standard print system of most MacOS and Linux desktop distributions is CUPS, MacOS and Linux users on the same network can automatically use the printer when you enable printer sharing via Bonjour/IPP on CentOS 8/RHEL 8. When you click the Print button in applications (word processors, e-mail readers, photo editors and web browsers), the printer is automatically available. There is no need to explicitly add a printer. It’s magical.

If your Linux computer cannot find a printer, there may not be an ippfind command on the system. To install it on a Debian-based Linux distribution, run the following command.

sudo apt install cups-ipp-utils

Execute the following command in CentOS 8.

sudo dnf cup nipple system

Then restart CUPS on the client computer.

restart sudo systemctl cups

Window

Windows 10 comes with an IPP client. Enter the printer in the search bar in the lower left corner and open Printer and Scanner. Then click on Add Printer or Scanner. It scans the printers available on the local network.

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

As you can see, he found my HP desktop printer. Select the printer you found and click Add Device. It will be added to the list of printers within minutes.

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

If you are using a different version of Windows that cannot add a printer this way, you can install Bonjour printing services. After installation, start the Hello Print Wizard. It automatically scans the printers available on the local network. As you can see from the screenshot, he found my HP printer.

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

Click Next, and then you need to select the driver for this printer. You can select the Microsoft IPP driver installed on the system by default.

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

Click Next and the printer will be added to your Windows system.

Manually adding a printer to Linux

If for some reason you cannot see the printer, you can add it manually. To add a Bonjour shared printer to your Linux desktop computer, look for the Printer Settings Utility in System Preferences or in the Application menu. Click the Add button to add a new printer.

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

Then click the Network Printers button and the printers available on your local network will be scanned automatically. As you can see, he found my HP desktop printer. Press the Forward button.

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

You can then give the printer a name and description. I only accept the default values. Click Apply and you’re ready to go.

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

Manual addition of a printer under MacOS

To add a shared Bonjour printer on MacOS, go to System Preferences -> Printers and Scanner. Press the Plus (+) button to add the printer.

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

It automatically scans the printers available on the local network. As you can see, he found my HP desktop printer.

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

Click on the Add button and it will appear in the list of printers.

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

Step 5: Enabling CUPS printers via Samba

Samba is a free and open source implementation of the SMB/CIFS protocol for Unix and Linux that makes it possible to exchange and print files between Unix/Linux and Windows machines on a local network. It is mainly used to exchange files and printers with Windows clients.

To install Samba on CentOS 8/RHEL 8, follow this command.

Installing sudo dnf Samba

Then type the following command to start the smbd and nmbd services.

sudo systemctl start smb nmb

Activate automatic start during charging.

activate sudo systemctl smb nmb

To check if a Samba service is running, follow these commands.

System status smb nmb

Once started, the smb daemon listens on TCP Ports 139 and 445. nmbd listens on UDP Ports 137 and 138. To open these ports in the firewall, follow the command below.

sudo firewall-cmd –permanent –add service=samba

Restart the Firvall daemon to initiate the change.

Restart sudo systemctl firewall

Then edit the main configuration file.

nano-ship /etc/samba/smb.conf

Find the [Printers] section. It looks like this by default:

Printer]
Note = all
Printerpad = /var/tmp
Printable = yes
Mask creation = 0600
Searchable = no

We need to change the value of Browseable to yes so clients on the same network can find a printer and add a guest ok = yes so everyone on the network can use the printer.

Printer]
comments = all
printer path = /var/tmp
printable = yes
mask creation = 0600
viewable = yes
guest ok = yes

It is recommended to activate the spooling service when using the printer at the same time. This makes Samba more efficient for a large number of print jobs. Add the following two lines to the [global] area to activate the rinsing service.

rpc_server:spoolss = external
rpc_daemon:spoolssd = fork

Save the file and close it. Then restart the samba.

sudo systemctl restart smb nmb

Adding a Samba Attachment Printer to Windows.

Open the file explorer, enter the IP address of your CentOS 8/RHEL 8 computer in the address bar \192.168.0.110 The printer should now be listed.

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

Double-click the printer to add it to your Windows system. Then click OK to select the driver to install. Once the driver is installed, the printer is added to the Windows system.

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

Step 6: Sharing a CUPS printer with iOS clients via AirPrint

AirPrint allows iPhone, iPad, and MacOS clients to print over Wi-Fi without installing drivers on client devices. BCCs support Airprint, but avahi-daemon does not advertise the AirPrint service on the LAN by default. We need to create a .service file in /etc/avahi/services/ for the printer using the Python script. To download the script in CentOS 8/RHEL 8, execute the following command.

Mailbox https://raw.github.com/tjfontaine/airprint-generate/master/airprint-generate.py

Add permission to appear.

chmod +x airprint Generate.py

This Python script is made for Python2. CentOS 8/RHEL 8 uses Python3 as standard. We need to install Python2.

sudo dnf installation python2

Edit this file.

nanoprint Generate.py

Edit.

#!/usr/bin/env python

at the following address:

#!/usr/bin/env python2

Save the file and close it. Then determine the dependencies.

sudo dnf set gcc redhat-rpm-confg python2-devel cup-dewell

Install the cup module.

sudo pip2 mugs

Then run this script.

sudo./airprint-generate.py -d /etc/avahi/services/

The /etc/avahi/services/directory of your printer should now contain a .service file.

ls /etc/avahi/ services/

Taking samples:

AirPrint DeskJet 2130 Series.service

Reboot the Avahi demon.

sudo systemctl restart avahi-daemon

Now iOS and MacOS clients on the same network should be able to use the printer. The following screenshot shows that my iPhone has managed to find an AirPrint printer.

Set up CUPS Print Server to CentOS 8 / RHEL 8 (Bonjour, IPP, Samba, AirPrint)

Packaging

I hope this guide has helped you configure the CUPS print server on CentOS 8/RHEL 8. As always, if you find this message useful, subscribe to our free newsletter for more tips and tricks. You can also read the following article about configuring the Samba file server.

Evaluate this training manual.

On second thought: 5 Average : 5]

More Stories
How to use AI to drive targeted customer acquisition by 2020.