0
0
Iot-protocolsHow-ToBeginner · 4 min read

How to Set Up Raspberry Pi as Print Server Quickly

To set up a Raspberry Pi as a print server, install CUPS (Common Unix Printing System) on the Pi, connect your printer, and configure CUPS to share the printer over the network. Then, add the Raspberry Pi printer on your other devices using the network printer option.
📐

Syntax

Here is the basic command syntax to install and configure CUPS on Raspberry Pi:

  • sudo apt update - Updates the package list.
  • sudo apt install cups - Installs the CUPS printing system.
  • sudo usermod -a -G lpadmin pi - Adds user pi to the printer admin group.
  • sudo cupsctl --remote-any - Allows remote access to CUPS.
  • sudo systemctl restart cups - Restarts the CUPS service.

These commands prepare the Raspberry Pi to act as a print server.

bash
sudo apt update
sudo apt install cups
sudo usermod -a -G lpadmin pi
sudo cupsctl --remote-any
sudo systemctl restart cups
💻

Example

This example shows how to install CUPS, add the default user to the printer admin group, enable remote access, and restart the service to set up the print server.

After running these commands, you can access the CUPS web interface at http://raspberrypi.local:631 to add and share your printer.

bash
sudo apt update
sudo apt install cups
sudo usermod -a -G lpadmin pi
sudo cupsctl --remote-any
sudo systemctl restart cups
Output
Reading package lists... Done Building dependency tree... Done Reading state information... Done The following NEW packages will be installed: cups 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 1,234 kB of archives. After this operation, 3,456 kB of additional disk space will be used. Setting up cups (2.3.3op2-3) ... Adding user pi to group lpadmin CUPS remote access enabled Restarting cups service... done
⚠️

Common Pitfalls

Common mistakes when setting up a Raspberry Pi print server include:

  • Not adding the user to the lpadmin group, which prevents printer management.
  • Forgetting to enable remote access with cupsctl --remote-any, so other devices cannot see the printer.
  • Not restarting the CUPS service after changes, causing settings not to apply.
  • Not configuring firewall rules to allow port 631 (IPP protocol) through.

Always check these steps to avoid connection issues.

bash
sudo apt install cups
# Missing usermod command
sudo cupsctl --remote-any
sudo systemctl restart cups

# Correct way:
sudo apt install cups
sudo usermod -a -G lpadmin pi
sudo cupsctl --remote-any
sudo systemctl restart cups
📊

Quick Reference

Summary of key commands to set up Raspberry Pi as a print server:

CommandPurpose
sudo apt updateUpdate package list
sudo apt install cupsInstall CUPS print server
sudo usermod -a -G lpadmin piAdd user to printer admin group
sudo cupsctl --remote-anyEnable remote access to CUPS
sudo systemctl restart cupsRestart CUPS service
Access http://raspberrypi.local:631Open CUPS web interface to add printers

Key Takeaways

Install CUPS on Raspberry Pi to manage printers.
Add your user to the lpadmin group to allow printer administration.
Enable remote access with cupsctl to share printers over the network.
Restart the CUPS service after configuration changes.
Use the CUPS web interface at port 631 to add and share printers.