If we have a usb printer and a Raspberry Pi system, we can easily setup a network printer. In order to make it active, we have to install the CUPS (formerly an acronym for Common Unix Printing System, but now with no official expansion). CUPS is a modular printing system for Unix-like computer operating systems which allows a computer to act as a print server.
Just go through the following steps to install CUPS on Raspberry Pi and enabling remote access.
- Install CUPS
sudo apt-get install cups
- Once the base installation is complete, we need to make a few small administrative changes. Execute this command in terminal.
sudo usermod -a -G lpadmin pi
- Now open /etc/cups/cupsd.conf
sudo nano /etc/cups/cupsd.conf
- Inside the file, look for this section:
# Only listen for connections from the local machine
Listen localhost:631 - Comment out the “Listen localhost:631″ line and replace it with the following:
# Only listen for connections from the local machine
# Listen localhost:631
Port 631 - Scroll further down in the config file until you see the “location” sections. In the block below, I’ve bolded the lines you need to add to the config:
# Restrict access to the server...
<Location />
Order allow,deny
Allow @local
</Location># Restrict access to the admin pages...
<Location /admin>
Order allow,deny
Allow @local
</Location># Restrict access to configuration files...
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow @local
</Location> - Anytime you make changes to the CUPS configuration file, you’ll need to restart the CUPS server. Do so with the following command:
sudo service cups restart
Now we can access the cups page
ip_address_of_pi:631
and add printers remotely.
As a test printer, I am installing a CUPS-PDF printer with the following steps.
- Install CUPS-PDF printer
sudo apt-get install cups-pdf - Make PDF folder inside home/pi/ to save the pdf files created
mkdir ~/PDF - Now check whether this printer is installed or not by opening the cups page remotely, ie.
ip_address_of_pi:631/printers
. If it shows as in the image given below, everything is ok.