Install, Configure & Share Printer in Linux | Set Up CUPS Print Server on CentOS 8 (RHEL 8)

Поделиться
HTML-код
  • Опубликовано: 22 авг 2024
  • Set Up CUPS Print Server on CentOS 8/RHEL 8:
    =====================================
    Step 1: Install and Configure CUPS on CentOS 8/RHEL 8
    CentOS 8/RHEL 8 desktop edition has CUPS pre-installed. If you use CentOS 8/RHEL 8 server edition, you need to run the following command to install CUPS from the default CentOS 8/RHEL 8 repository.
    dnf install cups
    Then start CUPS.
    systemctl start cups
    Enable auto-start at boot time.
    systemctl enable cups
    Check its status:
    systemctl status cups
    Next, edit the CUPS main configuration file with a command-line text editor like Nano.
    vim /etc/cups/cupsd.conf
    Find the following line.
    Listen localhost:631
    Change it to the following, So CUPS will listen on all network interfaces.
    Port 631
    Browsing On
    The above configuration only allows access to the CUPS web interface from localhost. To allow access from other computers in the same network, add Allow @LOCAL to the configuration like below.
    Allow @LOCAL
    If you want to allow remote administration from local network, also add it for the /admin directory.
    Allow @LOCAL
    Save and close the file. Then restart CUPS for the changes to take effect.
    systemctl restart cups
    We need to allow clients in the same network to access port 631 on your CentOS 8/RHEL 8 computer.
    firewall-cmd --permanent --add-port=631/tcp
    Reload firewall for the change to take effect.
    systemctl reload firewalld
    In addition to the main cups.service, there’s also cups-browsed.service, which is used to scan and add printer from the local network.
    systemctl start cups-browsed
    And enable auto-start at boot time.
    systemctl enable cups-browsed
    Step 2: Install Driver for Your Printer on CentOS 8/RHEL 8
    You need to install driver on CentOS 8/RHEL 8, so it can recognize and use the printer. If you have an HP printer, you can easily install the driver with the following command.
    dnf install hplip
    I also recommend installing the gutenprint-cups package, which provides CUPS drivers for Canon, Epson, HP and compatible printers.
    dnf install gutenprint-cups
    vim file.txt
    Nehra Classes Are Awesome!!!
    Set Default printer & check the status.
    lpoptions -d HP-Deskjet-3540
    lpstat -t
    Then run the following command to print this text file from the command line.
    lp file.txt
    This is a very rudimentary method, so don’t worry about printing quality now.
    Step 3: Share CUPS Printer via Bonjour/IPP Protocol
    Installing Avahi-daemon
    dnf install avahi
    We also need to install the nss-mdns package from EPEL repository, which is needed for clients to resolve .local domain on the network.
    dnf install epel-release
    dnf install nss-mdns
    Start avahi-daemon.
    systemctl start avahi-daemon
    Enable auto-start at boot time.
    systemctl enable avahi-daemon
    Avahi-daemon listens on UDP port 5353. Open it in the firewall.
    firewall-cmd --permanent --add-port=5353/udp
    Reload firewall for the change to take effect.
    systemctl reload firewalld
    add bonjour printer on windows
    To install Samba on CentOS 8/RHEL 8, run the following command.
    dnf install samba
    Then issue the following command to start the smbd and nmbd service.
    systemctl start smb nmb
    Enable auto-start at boot time.
    systemctl enable smb nmb
    To check if Samba service is running, issue the following commands.
    systemctl status smb nmb
    Once started, the smb daemon will be listening on TCP port 139 and 445. The nmbd will be listening on UDP port 137 and 138. Run the following command to open these ports in the firewall.
    firewall-cmd --permanent --add-service=samba
    Reload firwall daemon for the change the take effect.
    systemctl reload firewalld
    Then edit the main configuration file.
    vim /etc/samba/smb.conf
    We need to change the value of browseable to yes, so clients in the same network can find the printer and add guest ok = yes to allow anyone in the network to use the printer.
    [printers]
    comment = All Printers
    path = /var/tmp
    printable = Yes
    create mask = 0600
    browseable = yes
    guest ok = yes
    It’s recommended to enable the spoolssd service when sharing printer. This will make Samba more efficient when there’s lots of printing jobs. Simply add 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.
    Create & add samba user and then restart Samba.
    useradd samba
    passwd samba
    smbpasswd -a samba
    systemctl restart smb nmb
    Adding a Samba-shared Printer in Windows.
    Open file explorer, enter the IP address of the CentOS 8/RHEL 8 computer in the address bar like \\192.168.0.110. The printer should now be listed.
    ===
    Thanks for watching the video. If it helped you then, please do like & share it with others as well. Feel free to post your queries & suggestions, we will be glad to answer your queries.
    ===
    ©COPYRIGHT. ALL RIGHTS RESERVED.

Комментарии • 17

  • @hangoutbuddy
    @hangoutbuddy Год назад +1

    Thank you so much for a clear explanation of CUPS. This will really help me so much.

  • @podishettivikram8681
    @podishettivikram8681 3 года назад +1

    Superb video , we can also take print in Linux machines using cups ...

  • @antenna8093
    @antenna8093 2 года назад +1

    Thank you easy step follow, I have usb printer and install CentOS 9 can use same method ?

  • @AhmedAhmed-dh5uz
    @AhmedAhmed-dh5uz 2 года назад +1

    Thanks for tutorial. I am doing the CUPS server migration and found a user pdfspool who is this user? should i create this and this will come with some kind of package installation?

  • @shashidharreddyannapureddy443
    @shashidharreddyannapureddy443 2 года назад +1

    one of my client environment having out dated windows machines i.e. windows 7... etc. they want to use client machine as windows 7 to give prints without any issues. can you please suggest us which is suitable OS to deploy print management. in environment already they are having windows server 2012, 2012 R2, 2016 but the problem post installing the patches on those servers unable to print from windows 7 or outdated OS.

  • @filipwincenciak3222
    @filipwincenciak3222 3 года назад +1

    Hello, good tutorial.
    But i have problem with connect printer from windows. Linux printing correctly . Priter is ok, in samba widows work good, with folders share. Problem is when i try connect to pritner show me error about max connections.
    Any tips for that?

    • @NehraClasses
      @NehraClasses  3 года назад

      thanks, please provide us error details in our telegram channel.

  • @arijitbiswas1905
    @arijitbiswas1905 3 года назад

    How to access WAN sheared printer?? CUPS have only LAN access...

  • @hari830
    @hari830 2 года назад +1

    is there anyway to access printer connected to linux in android?

    • @NehraClasses
      @NehraClasses  2 года назад

      Yes, you can use any terminal software

    • @RogerioDuarte
      @RogerioDuarte 10 месяцев назад

      Hi, I installed Avahi to use the print in my cellphone. Cellphone not need any confirmation. Also Works on airplay.

    • @RogerioDuarte
      @RogerioDuarte 10 месяцев назад

      Hi, I installed Avahi to use the print in my cellphone. Cellphone not need any confirmation. Also Works on airplay.