I have an old computer and an old printer, but they still work and I’m poor, so here’s how to do it. My HP Laserjet P1005 is pretty solid and still works. Instructions are always changing, so this is only good up to 2021 Dec.
These notes How to set up HP printing on Ubuntu — HP Laserjet P1005 were the most accurate, though they date to 2009.
Skip the part where you download and install hplip, because the HP installer replaces it with a newer version. Go to HP Linux Imaging and Printing on Sourceforge, which will punt you to the HP site for Version: 3.21.10. Note where the download goes on your computer, as you will need to go to this directory. Also note your version number, which will change with an update. Here are the installer Walkthrough directions
$ sh hplip-3-21-10.run
It’ll ask you for automatic install, your Ubuntu version, password, then
- fix any missing dependencies (there were a lot)
- remove old version of hplip, install newer version
- build and install
- unplug and replug your printer
- discover and configure your printer
- A driver was missing, so the installer downloaded it
- print the test page
The process took about 20 minutes to complete. The end part was a bit odd. I first heard my printer whir, so I knew it was alive, but could not print a test page. After unplugging and replugging the printer i was able to get a test page printed correctly. The process did work.