How To Install Cups On Centos 7
This tutorial volition be showing yous how to share a printer fastened to a CentOS eight/RHEL 8 computer with Windows, macOS, and iOS clients on the same network. CUPS (Common Unix Printing Organisation) is the default printing system on Linux, FreeBSD, and macOS. Your Linux desktop environs may accept a dedicated printer configuration utility, just they all use CUPS under the hood. CUPS printer tin can be shared on the network using several protocols, including:
- Bonjour + IPP: Bonjour, besides known as mDNS/DNS-SD (multicast DNS/DNS service discovery), allows a computer to find services on the local network. IPP (Net Printing Protocol) is the transport protocol.
- SMB: aka Samba, 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. First, I will evidence you how to install and configure CUPS. Then we will learn how to share the CUPS printer via the above 3 protocols. I recommend using all iii methods to share your printer, so users can notice an available printer on the local network with minimal try.
Pace 1: Install and Configure CUPS on CentOS 8/RHEL eight
CentOS 8/RHEL 8 desktop edition has CUPS pre-installed. If you use CentOS viii/RHEL 8 server edition, you demand to run the following command to install CUPS from the default CentOS eight/RHEL eight repository.
sudo dnf install cups
And so kickoff CUPS.
sudo systemctl start cups
Enable machine-first at kick time.
sudo systemctl enable cups
Check its status:
systemctl status cups
Sample output:
Next, edit the CUPS main configuration file with a command-line text editor similar Nano.
sudo nano /etc/cups/cupsd.conf
By default, the CUPS web interface is but bachelor at localhost:631. If you are running CentOS eight/RHEL 8 server edition, you might desire to make CUPS listen on all available network interface, and then that yous will be able to access the CUPS spider web interface from other computers. Notice the post-obit line.
Listen localhost:631
Modify it to the following, So CUPS will listen on all network interfaces.
Port 631
The following line will make CUPS show shared printers on the local network, so other computers in the aforementioned network can run across printers connected to your CentOS 8/RHEL 8 reckoner.
Browsing On
So find the following lines.
<Location /> Gild allow,deny </Location>
The in a higher place configuration but allows access to the CUPS web interface from localhost. To let access from other computers in the same network, add Let @LOCAL to the configuration like below.
<Location /> Club allow,deny Allow @LOCAL </Location>
If you lot want to permit remote administration from local network, besides add together it for the /admin directory.
<Location /admin> Club allow,deny Allow @LOCAL </Location>
Salve and close the file. Then restart CUPS for the changes to accept effect.
sudo systemctl restart cups
Nosotros need to allow clients in the same network to access port 631 on your CentOS eight/RHEL eight estimator.
sudo firewall-cmd --permanent --add-port=631/tcp
Reload firewall for the alter to take result.
sudo systemctl reload firewalld
In addition to the master cups.service, in that location's also cups-browsed.service, which is used to browse and add together printer from the local network. If you want your CentOS 8/RHEL 8 reckoner to be able to utilize other printers on the local network, start this service.
sudo systemctl beginning cups-browsed
And enable auto-kickoff at kicking fourth dimension.
sudo systemctl enable cups-browsed
Stride two: Install Driver for Your Printer on CentOS 8/RHEL 8
You need to install driver on CentOS 8/RHEL eight, so it tin recognize and utilize the printer. If you take an HP printer, y'all can easily install the commuter with the post-obit control.
sudo dnf install hplip
I also recommend installing the gutenprint-cups packet, which provides CUPS drivers for Catechism, Epson, HP and compatible printers.
sudo dnf install gutenprint-cups
If yous accept other printers, you tin can find drivers on openprinting.org.
After installing the driver, you may need to re-connect the printer to the USB port of your CentOS 8/RHEL 8 computer. To test if the commuter is working correctly, you lot can create a text file on CentOS eight/RHEL viii:
echo "LinuxBabe is awesome!" > file.txt
So run the following command to print this text file from the control line.
lp file.txt
This is a very rudimentary method, so don't worry about printing quality at present.
Step 3: Share CUPS Printer via Bonjour/IPP Protocol
Installing Avahi-daemon
CUPS can announce its presence on the network via mDNS (multicast DNS) and DNS-SD (DNS Service Discovery) protocol, which is as well known as Bonjour. In lodge to practice that, you lot need to install and run avahi-daemon, which is a service similiar to the Apple Bonjour service that allows computers to automatically discover shared devices and services on the local network.
sudo dnf install avahi
We as well demand to install the nss-mdns package from EPEL repository, which is needed for clients to resolve .local domain on the network.
sudo dnf install epel-release sudo dnf install nss-mdns
Commencement avahi-daemon.
sudo systemctl starting time avahi-daemon
Enable machine-start at boot time.
sudo systemctl enable avahi-daemon
Avahi-daemon listens on UDP port 5353. Open up it in the firewall.
sudo firewall-cmd --permanent --add together-port=5353/udp
Reload firewall for the modify to take issue.
sudo systemctl reload firewalld
IPP Driverless Press
Bonjour is used to advertise the printer on the local network. To make clients and the CUPS server communicate with each other, IPP (Net Press Protocol) is needed. The reward of IPP is that clients can use the shared printer without installing whatever driver on their own devices. CUPS supports IPP out of the box, and then you don't need to practise anything else to share CUPS printer via IPP.
Step 4: Add Printer on Customer Computers
macOS and Linux Clients
Because macOS and most Linux desktop distributions have CUPS installed as the default printing system, one time you have enabled printer sharing via Bonjour/IPP on the CentOS viii/RHEL 8 box, macOS and Linux users in the same network can automatically apply the printer. When they click the print choice in applications (word processors, email readers, photo editors, and web browsers), the printer will be automatically available. They don't accept to explicitly add the printer. It's magic.
If your Linux computer can't find the printer, it's possible that your arrangement doesn't take the ippfind command. Run the post-obit control to install it on Debian-based Linux distribution.
sudo apt install cups-ipp-utils
On CentOS viii, run the following command.
sudo dnf install cups-ipptool
Then restart CUPS on the client computer.
sudo systemctl restart cups
Windows
Windows 10 ships with an IPP client. Type in printer in the lower-left search bar and open Printers & Scanners. Then click the Add a printer or scanner button. It will browse available printers on the local network.
As yous can encounter, it found my HP Deskjet printer. Select the found printer and click Add device. It will be added to the printer list in a few moments.
If y'all are using a different version of Windows that can't add printer this way, and so yous tin can install the Bonjour Print services. Once installed, launch the Bonjour printer wizard. It will automatically scan available printers on the local network. As you can see from the screenshot, it institute my HP printer.
Click next, then yous need to choose a driver for this printer. You can choose the Microsoft IPP form driver, which is installed on the system by default.
Click Next, and the printer will be added to your Windows organisation.
Manually Adding Printer on Linux
If for whatsoever reason yous don't see the printer, you can manually add ane. To add together a Bonjour-shared printer on desktop Linux, search your system settings or the application carte du jour for the printer configuration utility. Click the Add button to add a new printer.
And then click Network Printer, and it would automatically scan bachelor printers on the local network. As you tin see, it found my HP Deskjet printer. Click the Forrad push.
Then yous tin give the printer a name and description. I simply accept the default values. Click Use and you lot are washed.
Manually Calculation Printer on macOS
To add together a Bonjour-shared printer on macOS, go to organization preferences -> Printers & Scanners. Click the plus (+) button to add a printer.
It would automatically scan available printers on the local network. As you can see, it institute my HP Deskjet printer.
Click the Add push and it volition appear in the printer listing.
Step five: Share CUPS Printer via Samba
Samba is a free and open-source SMB/CIFS protocol implementation for Unix and Linux that allows for file and print sharing between Unix/Linux and Windows machines in a local expanse network. It's mainly used to share files and printer with Windows clients.
To install Samba on CentOS 8/RHEL 8, run the following command.
sudo dnf install samba
Then issue the following command to start the smbd and nmbd service.
sudo systemctl beginning smb nmb
Enable car-start at kicking fourth dimension.
sudo systemctl enable smb nmb
To check if Samba service is running, upshot the post-obit commands.
systemctl status smb nmb
Once started, the smb daemon will be listening on TCP port 139 and 445. The nmbd will exist listening on UDP port 137 and 138. Run the following command to open these ports in the firewall.
sudo firewall-cmd --permanent --add-service=samba
Reload firwall daemon for the change the take effect.
sudo systemctl reload firewalld
Then edit the main configuration file.
sudo nano /etc/samba/smb.conf
Find the [printers] section. By default, it looks like this:
[printers] annotate = All Printers path = /var/tmp printable = Yes create mask = 0600 browseable = No
Nosotros demand to change the value of browseable to aye, so clients in the same network can discover the printer and add together guest ok = yep to allow anyone in the network to utilize the printer.
[printers] comment = All Printers path = /var/tmp printable = Yes create mask = 0600 browseable = yeah guest ok = aye
It's recommended to enable the spoolssd service when sharing printer. This will make Samba more efficient when there'due south lots of printing jobs. Simply add together the following two lines in the [global] section to enable the spoolssd service.
rpc_server:spoolss = external rpc_daemon:spoolssd = fork
Save and close the file. So restart Samba.
sudo systemctl restart smb nmb
Calculation a Samba-shared Printer in Windows.
Open file explorer, enter the IP accost of the CentOS 8/RHEL 8 calculator in the address bar like \\192.168.0.110. The printer should now be listed.
Double-click the printer to add it to your Windows system. So click OK push button to select a commuter to install. After installing the driver, the printer volition be added to your Windows system.
Step half-dozen: Share CUPS Printer with iOS Clients via AirPrint
AirPrint allows iPhone, iPad, and macOS clients to print over Wi-Fi without installing commuter software on the customer devices. CUPS supports Airprint, but avahi-daemon by default doesn't denote AirPrint service on the local network. We need to create a .service file in the /etc/avahi/services/ directory for the printer with a Python script. Run the following control to download the script on CentOS 8/RHEL 8.
wget https://raw.github.com/tjfontaine/airprint-generate/master/airprint-generate.py
Add together execute permission.
chmod +x airprint-generate.py
This python script is fabricated for Python2. CentOS eight/RHEL 8 uses Python3 past default. We need to install Python2.
sudo dnf install python2
Edit this file.
nano airprint-generate.py
Change
#!/usr/bin/env python
to
#!/usr/bin/env python2
Save and shut the file. And then install dependencies.
sudo dnf install gcc python2-devel cups-devel redhat-rpm-config
Install the cups module.
sudo pip2 install cups pycups
And so run this script.
sudo ./airprint-generate.py -d /etc/avahi/services/
Now in that location should a .service file under /etc/avahi/services/ directory for your printer.
ls /etc/avahi/services/
Sample output:
AirPrint-DeskJet-2130-series.service
Restart Avahi-daemon.
sudo systemctl restart avahi-daemon
Now iOS and macOS clients in the same network should be able to apply your printer. The following screenshot shows my iPhone successfully found an AirPrint Printer.
Wrapping Up
I hope this tutorial helped yous gear up a CUPS print server on CentOS 8/RHEL 8. As always, if you found this mail useful, then subscribe to our free newsletter to go more tips and tricks. And you may also want to read the following article to set up a Samba file share server.
- Set Upwardly Samba Server on CentOS 8/RHEL 8 for File Sharing
Source: https://www.linuxbabe.com/redhat/cups-print-server-centos-8-bounjour-ipp-samba-airprint
Posted by: beaversardiner44.blogspot.com

0 Response to "How To Install Cups On Centos 7"
Post a Comment