Setting up a HP Printer in Linux

Jun 13, 2022 20:47 · 187 words · 1 minute read linux howto

I have a “HP DeskJet Ink Advantage 4535” printer in the house. I’ll be doing a lot of printing in the house given that I am committed to reading more papers more consistently—I’m growing to prefer physical media to virtual media. That said, here are the steps I took to set-up my printer over my home network:

  • First, install all the necessary packages from ArchLinux:
sudo pacman -S cups avahi nss-mdns hplip
  • Next, edit /etc/cups/cupsd.conf with the following specific edits:

      [...]
      # Only listen for connections from the local machine.
      Port 631
      Listen /run/cups/cups.sock
    
      [...]
    
      # Restrict access to the server...
      <Location />
        Order allow,deny
        Allow @LOCAL
      </Location>
    
      # Restrict access to the admin pages...
      <Location /admin>
        AuthType Default
        Require valid-user
        Order allow,deny
        Allow @LOCAL
      </Location>
    
      [...]
    
  • Next make sure that the relevant services are enabled/started:

sudo pacman systemctl enable cups avahi-daemon.service
  • Thereafter, scan for the printer:
lpinfo --include-schemes dnssd -v
  • Use the url found in the previous step to add the printer using the web-interface at “localhost:673”