Skip to main content

Raspberry Pi Zero Printer Server

For Christmas I got a Raspberry Pi Zero-W single-board computer. They cost around $10 and are amazingly tiny and use very little power.
My goal was to attach this to the usb printer (HP LaserJet 1020) in my home to share it on the network without having to have a desktop computer attached to it and running all the time. This would be much cheaper than buying a new wireless enabled HP printer ($200). Also this would give me a good excuse to play with one of these little single-board computers...

There were a few hurdles to get everything working but I did succeed after some googling and tinkering. It's been working like a champ so far and now I can print from all our home computers and Android phones.

I mostly followed this tutorial. Here are the steps to set this up...
  1. Download the Lite version of Raspbian. This is a minimal Linux distro based on Debian. 
  2. Use Etcher (or something similar) to copy the Raspbian image to a micro SD disk (you don't need to unzip it). In this case I had an old 2 GB micro SD card from an old phone. It worked great because I wasn't going to load much on this system.
  3. Insert the micro sd card into the Pi. 
  4. Hook up a keyboard and monitor. 
  5. Power up the Pi.
  6. Log in as 'pi' with password 'raspberry'
  7. Configure the Pi with the Pi Software Configuration Tool. You should set up wireless networking, change the root password and also enable SSH.
    > sudo raspi-config
  8. At this point you can look up your ip address and connect remotely via SSH. I recommend doing this so you can disconnect the monitor and keyboard.
    > ip address
  9. Be sure to update at this point
    > sudo apt-get update
    > sudo apt-get upgrade
  10. Install CUPS
    > sudo apt-get install cups
  11. Add the pi user to the lpadmin group
    > sudo usermod -a -G lpadmin pi
  12. Set permissions to allow access from anywhere (assuming your behind a firewall)
    > sudo cupsctl --remote-any
    > sudo /etc/init.d/cups restart
  13. Install Samba (assuming you want access from Windows machines)
    > sudo apt-get install samba
  14. Configure Samba printer sharing
    > sudo nano /etc/samba/smb.conf

    #CUPS printing.
    [global]
    printing = CUPS

    [printers]
    comment = All Printers
    browseable = no
    path = /var/spool/samba
    printable = yes
    guest ok = yes
    read only = yes
    create mask = 0700

    [print$]
    comment = Printer Drivers
    path = /var/lib/samba/printers
    browseable = yes
    read only = no
    guest ok = no
  15. Add a spool directory
    > sudo mkdir -p /var/spool/samba/
    > sudo chmod 1777 /var/spool/samba/
  16. Restart Samba
    > smbcontrol all reload-config
    > sudo /etc/init.d/samba restart
  17. Add HP Driver (optional)
    > apt-get install hplip
  18. You may need to add a root password for the HP stuff to work
    > sudo passwd root
  19. Install the HP driver plugin
    > hp-plugin -l
  20. Add a CUPS printer through a browser on another computer
    http://[server_ip]:631
    Go to the administration panel to add the printer
  21. Restart samba again
    > sudo /etc/init.d/samba restart
  22. Add the printer on a Windows machine
    • Goto Settings->Printers->Add Printer
    • Click Local Printer, then next
    • Create a new port
    • Set Type = Local Port, next
    • Set the SMB share name
      • Example '\\MYPI\HP_LaserJet_1020'
(Hopefully)

Comments