Skip to content

Instantly share code, notes, and snippets.

@bcastellano
Last active July 1, 2024 02:13
Show Gist options
  • Save bcastellano/ae63e9e2da2c3d068c0014ed6963a5a1 to your computer and use it in GitHub Desktop.
Save bcastellano/ae63e9e2da2c3d068c0014ed6963a5a1 to your computer and use it in GitHub Desktop.
Configure Raspberry to be print server with cups and adding HP LaserJet 1020

Configure raspberry (model 1 B)

Followed tutorials:

Url to access to the server once installed https://SERVER_IP:631/.

1. Install Rasbian OS

Installed raspbian using Raspberry Pi Imager v1.2, desktop app to install SO in the SD from a computer. Installed Raspbian without user interface.

2. Configure Rasberry

Execute from console sudo raspi-config to configure: -> set keyboard layout -> set timezone -> set wifi network, SSID name + pass

3. Update packages and install SSH (should be installed)

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install openssh-client #<- should be installed
sudo apt-get install openssh-server #<- should be installed

4. Enable SSH

Execute sudo raspi-config and do it from menu OR do it directly sudo systemctl enable ssh and sudo systemctl start ssh

5. Install Cups

sudo apt-get install cups
sudo usermod -a -G lpadmin pi
sudo nano /etc/cups/cupsd.conf
#	-> see changes below
sudo service cups restart

Tendremos que comentar o eliminar algunas líneas que hacen que por defecto la administración sea local. Añadiremos otras para poder acceder de forma remota.

# Only listen for connections from the local machine.
#Listen localhost:631
Listen *:631
Listen /var/run/cups/cups.sock

La red en la que está mi Raspberry Pi, es 192.168.1.*, así que permitiré el acceso a cualquier máquina de esa misma red: You can allow same IP range for logs and other sections

# Restrict access to the server...

  Order allow,deny
  Allow 192.168.1.*


# Restrict access to the admin pages...

  Order allow,deny
  Allow 192.168.1.*


# Restrict access to configuration files...

  AuthType Default
  #Require user @SYSTEM
  Allow 192.168.1.*
  Order allow,deny

Finally restart cups sudo service cups restart

6. Install HP LaserJet 1020 driver for CUPS

Click the link, or cut and paste the whole command line below to download the driver.

    $ wget -O foo2zjs.tar.gz http://foo2zjs.rkkda.com/foo2zjs.tar.gz

Now unpack it:

    $ tar zxf foo2zjs.tar.gz
    $ cd foo2zjs

Now compile and install it. The INSTALL file contains more detailed instructions; please read it now.

Compile:
    $ make

Get extra files from the web, such as .ICM profiles for color correction,
and firmware.  Select the model number for your printer:
    $ ./getweb cpwl	# Get Minolta Color PageWorks/Pro L .ICM files
    $ ./getweb 2200	# Get Minolta 2200 DL .ICM files
    $ ./getweb 2300	# Get Minolta 2300 DL .ICM files
    $ ./getweb 2430	# Get Minolta 2430 DL .ICM files

    $ ./getweb 1000	# Get HP LaserJet 1000 firmware file
    $ ./getweb 1005	# Get HP LaserJet 1005 firmware file
    $ ./getweb 1018	# Get HP LaserJet 1018 firmware file
    $ ./getweb 1020	# Get HP LaserJet 1020 firmware file

    $ ./getweb 1025	# Get HP LaserJet Pro CP1025nw .ICM files

Install driver, foomatic XML files, and extra files:
    $ su			OR	$ sudo make install
    # make install

(Optional) Configure hotplug (USB; HP LJ 1000/1005/1018/1020):
    # make install-hotplug	OR	$ sudo make install-hotplug

(Optional) If you use CUPS, restart the spooler:
    # make cups			OR	$ sudo make cups

7. Add printer to CUPS and your computer

Finally add printer to CUPS here https://SERVER_IP:631/admin and using drivers from step #6. Add the printer ...@ raspberry to computers. Let's print!!!

Configure printer in MacOS (only if just add it doesn't work)

If once the printer added to the MacOs the printer job says "Hold for authentication", then follow this steps to enable Kerberos authentication:

  1. Add printer with "Generic Postcript Printer" driver.
  2. Execute: lpstat -s and pick the printer name (after text 'device for') example: "HP_LaserJet_1020___raspberrypi"
  3. Execute: sudo lpadmin -p [PRINTER-NAME] -o auth-info-required=negotiate.
@anku-r
Copy link

anku-r commented Feb 17, 2023

Thanks for this post!!
This helped me setting up hp laserjet 1020 on my orange pi zero.

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