A Raspberry Pi print server connects a USB printer to the network so any device in the house can print without the printer being physically attached to a computer. CUPS (Common Unix Printing System) handles the print queue and drivers. Samba shares the printer to Windows machines over SMB. Avahi provides AirPrint discovery for iPhones, iPads, and Macs without any additional software. This guide covers the complete setup on Bookworm Lite, including the corrected static IP method, Samba configuration with proper CUPS backend integration, and security hardening.
Last tested: Raspberry Pi OS Bookworm Lite 64-bit | May 2025 | Raspberry Pi 4 Model B (2GB) | CUPS 2.4.7, Samba 4.17, Avahi 0.8, HP LaserJet P1102w USB
Key Takeaways
- The default username on Bookworm is not
pi. It is whatever you set in Raspberry Pi Imager’s advanced settings before flashing. All commands that reference the username, particularlysudo usermod -aG lpadmin pi, must use your actual username or$USER. Running the command withpion a Bookworm system silently fails to add the correct user to the lpadmin group. - Static IP configuration on Bookworm uses NetworkManager, not
dhcpcd.conf. The/etc/dhcpcd.confmethod is deprecated and absent from Bookworm. Usenmclifor a static IP or set a DHCP reservation on your router. The router reservation approach requires no Pi-side configuration and survives OS reinstalls. - CUPS on Bookworm defaults to listening on localhost only. Before the web interface at port 631 is accessible from another machine on the network, the
Listendirective in/etc/cups/cupsd.confmust be changed fromListen localhost:631toPort 631, and theAllowdirectives must include the local network. This step is missing from most CUPS setup guides.
Hardware for a Raspberry Pi Print Server
Any Pi model from Pi 3 onward handles print server duty without CPU contention. Pi Zero 2W works for a single-printer setup and its low idle power draw (roughly 0.4W) makes it suitable for always-on use. Pi 4 or Pi 5 provide headroom for multiple printers or simultaneous large print jobs. The Pi does not need a display or keyboard after initial setup; it runs headless over SSH.
Hardware checklist: Raspberry Pi 3, 4, or 5 (Pi Zero 2W for minimal power builds). Official USB-C PSU (5V/3A for Pi 4, 5V/5A for Pi 5). USB cable compatible with your printer. microSD card, 8GB minimum. Ethernet cable for a stable connection. WiFi works but a wired connection prevents intermittent print failures caused by WiFi drops.
The printer must have a Linux driver available. Check the OpenPrinting database at openprinting.org/printers before starting. Most modern HP, Brother, Epson, and Canon printers are supported. If the printer model is not in the OpenPrinting database, it may work with a generic PostScript or PCL driver, but print quality and feature support will be limited. Older GDI (Windows-only) printers do not work with CUPS at all.

Installing and Configuring CUPS on Raspberry Pi
Flash Raspberry Pi OS Bookworm Lite using Raspberry Pi Imager. Set hostname, username, password, and enable SSH in the Imager advanced settings. After first boot, update and install CUPS:
sudo apt update && sudo apt full-upgrade -y
sudo apt install -y cups
Add your user to the lpadmin group so you can manage printers through the CUPS web interface without sudo:
sudo usermod -aG lpadmin $USER
Edit the CUPS configuration to allow access from the local network. By default on Bookworm, CUPS only listens on localhost:
sudo nano /etc/cups/cupsd.conf
Make these two changes. First, replace Listen localhost:631 with Port 631 near the top of the file. Second, add Allow @local to the Location blocks:
# Change this:
# Listen localhost:631
# To:
Port 631
# In both Location blocks, add Allow @local:
<Location />
Order allow,deny
Allow @local
</Location>
<Location /admin>
Order allow,deny
Allow @local
</Location>
Save the file and restart CUPS:
sudo systemctl restart cups
Expected result: Navigating to http://[pi-hostname]:631 from another device on the same network shows the CUPS web interface. If the page does not load, verify the Port 631 change was saved correctly and that systemctl status cups shows active (running).
Connect the printer via USB and add it in CUPS. Navigate to Administration > Add Printer. CUPS lists detected USB printers at the top. Select your printer, click Continue, choose the driver (CUPS will suggest the best match automatically for most printers), configure default options (paper size, quality), check the “Share This Printer” box, and click Add Printer.
For HP printers, install HPLIP first for better driver support:
sudo apt install -y hplip
For Brother printers, download the Linux driver package from the Brother support site for your specific model and install it before adding the printer in CUPS. For Epson and Canon, install printer-driver-gutenprint as a fallback if the model-specific driver is not available:
sudo apt install -y printer-driver-gutenprint
Expected result: The printer appears in the CUPS printer list with status “Idle.” Sending a test page from CUPS Administration prints successfully. If the test page fails, check sudo tail -20 /var/log/cups/error_log for the specific driver or communication error.
Samba for Windows Printer Sharing on Raspberry Pi Print Server
Samba makes the CUPS printer visible to Windows machines as a network printer over SMB. Install Samba:
sudo apt install -y samba
Edit the Samba configuration to enable printer sharing with proper CUPS backend integration:
sudo nano /etc/samba/smb.conf
In the [global] section, add these two lines so Samba uses CUPS as its print backend:
printing = cups
printcap name = cups
At the end of the file, add the printer and driver share sections:
[printers]
comment = All Printers
browseable = yes
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /usr/share/cups/drivers
browseable = yes
read only = yes
guest ok = no
Create the spool directory and set permissions, then restart Samba:
sudo mkdir -p /var/spool/samba
sudo chmod 1777 /var/spool/samba
sudo systemctl restart smbd
Expected result: On a Windows machine, open File Explorer, type \\[pi-hostname] in the address bar, and the shared printer appears. Right-click and select Connect to install it as a Windows printer. Windows may prompt for a driver; if the printer model is not in Windows’ driver library, download the Windows driver from the manufacturer’s site and point the wizard to it. On Linux, add the printer via the GNOME or KDE print settings dialog using the SMB URI smb://[pi-hostname]/[printer-name].
AirPrint, Printer Drivers, and Job Management
Avahi provides mDNS (Bonjour) service discovery that makes CUPS printers automatically appear as AirPrint devices on iPhones, iPads, and Macs. On Raspberry Pi OS Bookworm Lite, Avahi is not pre-installed. Install it:
sudo apt install -y avahi-daemon
Avahi starts automatically and requires no further configuration. CUPS registers each shared printer with Avahi, which broadcasts the printer’s presence on the local network. On an iPhone or iPad, open any app’s print dialog and tap Select Printer. The CUPS-shared printer appears under AirPrint printers within a few seconds.
Expected result: The printer appears in the iOS print dialog without any manual configuration on the Apple device. If it does not appear, verify systemctl status avahi-daemon shows running, and confirm the printer is shared in CUPS (the “Share This Printer” checkbox must be enabled in the printer’s CUPS settings).
Print jobs are managed through the CUPS web interface at http://[pi-hostname]:631. Navigate to Jobs to see the current queue. From the command line over SSH, useful job management commands are:
lpstat -p # list printers and status
lpq # show print queue
lpstat -o # list active jobs with job IDs
cancel [job-id] # cancel a specific job
sudo cancel -a # clear all jobs in queue
Security and Remote Access for a Raspberry Pi Print Server
A print server on a home network does not need to be exposed to the internet, but it should have basic hardening in place. Configure UFW to allow only the required ports from the local subnet:
sudo apt install -y ufw
sudo ufw allow from 192.168.1.0/24 to any port 631 # CUPS
sudo ufw allow from 192.168.1.0/24 to any port 139 # Samba
sudo ufw allow from 192.168.1.0/24 to any port 445 # Samba
sudo ufw limit ssh
sudo ufw enable
Adjust the subnet (192.168.1.0/24) to match your network. ufw limit ssh rate-limits SSH connection attempts without blocking them entirely.
Enable SSH key authentication. Generate an ed25519 key on your local machine and copy it to the Pi:
ssh-keygen -t ed25519 -C "print-server"
ssh-copy-id youruser@pi-hostname
Once key authentication works, disable password login:
sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
sudo systemctl restart ssh
Enable CUPS authentication for administrative actions so that only authorised users can add or remove printers. Edit /etc/cups/cupsd.conf and add AuthType Default and Require user @SYSTEM to the <Location /admin> block:
<Location /admin>
Order allow,deny
Allow @local
AuthType Default
Require user @SYSTEM
</Location>
Restart CUPS after saving. Administrative actions in the web interface now prompt for the Pi user’s system credentials.
For secure remote access to the CUPS interface from outside the home network, use Tailscale rather than opening port 631 on your router. See Tailscale Raspberry Pi: Complete Secure Remote Access Guide. For monitoring the Pi’s resource usage as the print server runs, see Raspberry Pi Power Monitoring via USB.
Troubleshooting a Raspberry Pi Print Server
CUPS web interface unreachable from other devices. The most common cause on Bookworm is the Listen localhost:631 default that was not changed to Port 631 in cupsd.conf. Verify the change with grep -n "^Port\|^Listen" /etc/cups/cupsd.conf. It should show Port 631. If it still shows Listen localhost:631, edit the file and restart CUPS.
Printer not detected in CUPS. Run lpinfo -v to list all devices CUPS can see. A USB printer appears as usb://[make]/[model]. If it does not appear, check dmesg | tail -20 after plugging in the printer for USB recognition errors. Verify the USB cable is data-capable (not charge-only). Some USB-C printer cables are charge-only and will not transmit data.
Print jobs stuck in queue. Check the CUPS error log with sudo tail -30 /var/log/cups/error_log. Common causes: wrong driver selected (the job reaches the printer but produces garbage output), printer offline or out of paper (the job queues but cannot complete), or a permissions issue on the spool directory. Restarting CUPS with sudo systemctl restart cups clears transient queue locks. Use sudo cancel -a to clear the queue if the job is stuck in processing state.
Windows cannot find the printer. Verify Samba is running with systemctl status smbd. Confirm the printing = cups and printcap name = cups lines are in the [global] section of smb.conf. On Windows 11, SMB1 is disabled by default; if the printer does not appear when browsing the network, add it manually using its UNC path \\[pi-hostname]\[printer-name] in the Add Printer wizard.
AirPrint printer not appearing on iPhone or iPad. Check that avahi-daemon is running with systemctl status avahi-daemon. Verify the printer is shared in CUPS: open the printer’s properties in the CUPS web interface and confirm “Share This Printer” is checked. Both the Pi and the Apple device must be on the same WiFi network segment. AirPrint does not work across VLANs unless mDNS is bridged between them.
FAQ
Which printers work with a Raspberry Pi print server?
Any printer with a Linux driver listed in the OpenPrinting database at openprinting.org/printers works with CUPS. Most HP, Brother, Epson, and Canon models have full driver support. HP printers use the HPLIP package. Brother printers use drivers downloaded from Brother’s Linux support page. Older GDI printers (common on inexpensive inkjets from the early 2000s) do not work with CUPS because they require Windows-only raster processing. Check the database before purchasing a printer specifically for this project.
Do I need Samba if I only use Apple devices?
No. AirPrint on Apple devices uses CUPS directly via Avahi/mDNS discovery. Samba is only required for Windows and Linux machines using SMB. If your household is entirely Apple, install CUPS and Avahi and skip Samba entirely. The print server is simpler and has a smaller attack surface without Samba running.
Can a Raspberry Pi print server handle multiple printers?
Yes. Add each printer through the CUPS web interface. Each appears as a separate printer on the network. Samba and Avahi advertise all shared CUPS printers automatically. A Pi 4 handles 3-4 simultaneous print jobs across multiple printers without CPU issues. CUPS printer classes allow grouping multiple printers so jobs route to the first available, which is useful for two identical printers in a small office.
How do I assign a static IP to my Raspberry Pi print server?
The recommended approach on Bookworm is a DHCP reservation on your router: log into the router admin page, find the DHCP reservation or static lease section, and assign a fixed IP to the Pi’s MAC address. This requires no Pi-side configuration and survives OS reinstalls. If the router does not support DHCP reservations, use nmcli to assign a static IP: sudo nmcli con mod "Wired connection 1" ipv4.addresses 192.168.1.100/24 ipv4.method manual, then sudo nmcli con up "Wired connection 1". Do not edit /etc/dhcpcd.conf; that file does not exist on Bookworm.
Why is my Raspberry Pi print server not accessible after reboot?
Three common causes. First, the IP address changed because DHCP assigned a different address; set a router DHCP reservation. Second, CUPS or Samba failed to start; check with systemctl status cups and systemctl status smbd. Third, the printer was unplugged and CUPS marked it offline; reconnect the printer and use sudo cupsenable [printer-name] to re-enable it. Adding Restart=on-failure to the CUPS systemd override (sudo systemctl edit cups) ensures CUPS recovers automatically if it crashes.
References:
- CUPS documentation: openprinting.github.io/cups
- OpenPrinting printer database: openprinting.org/printers
- HPLIP (HP Linux Imaging and Printing): developers.hp.com/hp-linux-imaging-and-printing
- Samba documentation: samba.org/samba/docs
- Raspberry Pi Imager: raspberrypi.com/software
About the Author
Chuck Wilson has been programming and building with computers since the Tandy 1000 era. His professional background includes CAD drafting, manufacturing line programming, and custom computer design. He runs PidiyLab in retirement, documenting Raspberry Pi and homelab projects that he actually deploys and maintains on real hardware. Every article on this site reflects hands-on testing on specific hardware and OS versions, not theoretical walkthroughs.
Last tested hardware: Raspberry Pi 4 Model B (2GB), HP LaserJet P1102w via USB. Last tested OS: Raspberry Pi OS Bookworm Lite 64-bit. CUPS 2.4.7, Samba 4.17, Avahi 0.8.

