Skip to content

Instantly share code, notes, and snippets.

@leafstorm
Created April 11, 2017 02:09
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save leafstorm/b2e91b9c9b66c82732e3d483fd90aa9f to your computer and use it in GitHub Desktop.
Save leafstorm/b2e91b9c9b66c82732e3d483fd90aa9f to your computer and use it in GitHub Desktop.
How to set up a CUPS print server running Fedora Server for an HP printer, and connect to it from your Fedora Workstation:

How to set up a CUPS print server running Fedora Server for an HP printer, and connect to it from your Fedora Workstation:

Run these commands on the server:

dnf install cups hplip
systemctl start cups
firewall-cmd --zone=FedoraServer --add-service=ipp
firewall-cmd --zone=FedoraServer --add-service=ipp --permanent

Then go to the CUPS Web admin at http://[server]:631 and go to the "Administration" page. Check the "Share printers connected to this system" box and save. Click the "Add Printer" button, and fill out all your printer's information.

Then, on your workstation, go to add the printer and type in the server's domain name/IP. After you add the printer, click on the printer model and choose "Select from database..." Pick the manufacturer "Raw" and the device type "Raw queue." Otherwise you will get weird untraceable errors.

@agriffis
Copy link

agriffis commented May 17, 2018

CUPS on Fedora only listens on localhost by default. So in addition to opening the firewall, you also need to fix that:

sed -i -e 's/^Listen localhost:631$/Port 631/' /etc/cups/cupsd.conf
systemctl restart cups

and you need to enable remote administration as well. This command does the trick:

cupsctl --remote-admin --remote-any --share-printers --user-cancel-any
systemctl restart cups

@boss0007000
Copy link

Is it the same code if I want to use the printer on windows?

@HasanAbbadi
Copy link

HasanAbbadi commented Feb 14, 2024

Is it the same code if I want to use the printer on windows?

Yes! I don't know what did it for me but I finally got it working after running all these:

dnf install cups hplip
systemctl start cups
systemctl start cups-browsed
systemctl enable cups-browsed

sed -i -e 's/^Listen localhost:631$/Port 631/' /etc/cups/cupsd.conf
cupsctl --remote-admin --remote-any --share-printers --user-cancel-any
systemctl restart cups

firewall-cmd --permanent --add-port=631/tcp
firewall-cmd --zone=FedoraServer --add-service=ipp
firewall-cmd --zone=FedoraServer --add-service=ipp --permanent
systemctl reload firewalld

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment