Skip to content

Instantly share code, notes, and snippets.

@Solarflame5
Last active September 21, 2025 08:06
Show Gist options
  • Save Solarflame5/e38d25c495bb82e3605029ba37792e45 to your computer and use it in GitHub Desktop.
Save Solarflame5/e38d25c495bb82e3605029ba37792e45 to your computer and use it in GitHub Desktop.
How to set up an HP LaserJet 1020 printer server using CUPS on Raspberry Pi OS Bullseye

How to set up an HP LaserJet 1020 printer server using CUPS on Raspberry Pi OS Bullseye

Set up the Raspberry Pi

Note: This probably also works in Raspberry Pi OS Bookworm, but I have only tested this on my Pi 1 B+ that doesn't support Bookworm. It should also probably work on most Debian based distros including Ubuntu.

  • Flash the Raspbian Bullseye Lite image to the SD card
  • Configure the user account, network and SSH settings while imaging to make setup easier.

Install the required packages

You need to install CUPS, HPLIP, and the foo2zjs printer drivers, use the following commands:

sudo apt update
sudo apt install cups hplip printer-driver-foo2zjs

CUPS will handle managing printers and sharing them to your network, HPLIP is required to upload the printer firmware to the printer, and the foo2zjs drivers are required for printing.

Set up CUPS

Run the following commands to allow configuring CUPS without logging in as root and from other computers in the network:

sudo usermod -a -G lpadmin [your username]
sudo cupsctl --remote-any
sudo systemctl restart cups

Set up the HP Plugin

The HP LaserJet 1020 requires its firmware to be uploaded everytime its connected, HPLIP handles this automatically after setting it up. Plug in your printer, turn it on, and then run the following command:

sudo hp-plugin -i

Then follow these steps:

  1. Choose "Download plug-in from HP (recommended)"
  2. Accept the license terms for the plugin
  3. Wait for it to install

Configure your printer in CUPS

  1. Open the web interface for CUPS by navigating to https://[Your pi's IP]:631(https://192.168.1.17:631 for example)
  2. Click "Administration" in the top navigation bar
  3. Click the "Add printer" button under Printers
  4. Select "HP LaserJet 1020 USB FN2Z0GV HPLIP (HP LaserJet 1020)" under "Local Printers"
  5. Check "Share this printer" to use it across the network.
  6. Click "Continue"
  7. Select "HP LaserJet 1020 Foomatic/f002zjs-z1 (recommended) (en)" under the printer model, make sure that the make is "HP"
  8. Click "Add printer"
  9. Click "Set default options"

Now you need to set the postscript renderer to ghostscript in cups-filters, run the following command in the terminal using your printer's name("HP_LaserJet_1020" for example):

lpadmin -p [your printer's name in CUPS] -o pdftops-renderer-default=gs

Test the printer

Go back to the CUPS web interface, and navigate to your printer's page, click the "Maintenance" drop down and click "Print test page", you have successfully set up your printer if it prints without any problems.

@ddscentral
Copy link

Can confirm this also works on Ubuntu 22.04 (armbian) on a Rockchip ARM SBC.
Thanks for the tutorial.

The URL to connect to your printer from Windows is http://[your ip address]:631/printers/[your printer's name in CUPS]
(not https !)

@Solarflame5
Copy link
Author

Can confirm this also works on Ubuntu 22.04 (armbian) on a Rockchip ARM SBC. Thanks for the tutorial.

The URL to connect to your printer from Windows is http://[your ip address]:631/printers/[your printer's name in CUPS] (not https !)

@ddscentral In my case the printer did show up automatically under network printers on both Windows and iOS, FYI

@ddscentral
Copy link

ddscentral commented May 17, 2025

For me it didn't show up in Windows 10. It could just be my firewall/configuration though.
But manually adding did work fine.
Now trying to figure out if there's any way to get this working under Windows 11...

@Solarflame5
Copy link
Author

For me it didn't show up in Windows 10. It could just be my firewall/configuration though. But manually adding did work fine. Now trying to figure out if there's any way to get this working under Windows 11...

@ddscentral the manual addition process should be the same on Windows 10 and 11, I was also using Windows 11 when I wrote this.

After failing to discover a network printer an "Add a new device manually" button will appear that opens the old Windows 7 style wizard.
image

@ddscentral
Copy link

ddscentral commented Jun 2, 2025

I do know manual adding is the same, I had no trouble with that. The issue was about getting some kind of printer driver to work on my Surface Pro 11 which uses Snapdragon X Elite which is ARM64.

"Microsoft PS Class Driver" seems to work with CUPS.

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