Tested with HP LaserJet 1018.
- Set up Raspbian buster as usual. https://raspberrypi.stackexchange.com/a/57023 helped with headless setup of Wifi and SSH.
- Change /etc/hostname and /etc/hosts to set hostname.
- sudo apt-get install cups hplip
- sudo hp-setup -i
- sudo cupsctl --share-printers
- avahi-browse -art on desktop should show your printer.
You can forward port 631 over ssh to log in to the CUPS web interface. You may have to set a root password to do certain operations over the browser interface.