(Guide) Converting USB Printer to Network Printer

arunmcops

Disciple
Hi,
I was having a network/PC setup as for attached diagram.
IMG_20201224_121910.jpg
I have HP Ink tank 310 Printer which was in other roomand printer does not have any Ethernet port,only a USB port. I was unable to use printer on my network as it only came with USB. I was having a spare Raspberry Pi 3B. This guide is based on using it to convertUSB printer to network printer and using it with all network devices for printing.
Raspberry-Pi-Print-Server-using-CUPS_0.jpg


Print Server can connect multiple computers to a single or multiple printers wired or wirelessly. With the help of the Print server, you can access your printer with multiple devices and can send the print command from any of the connected devices to the printer to print any document.

For this Raspberry Pi Print Server tutorial, we will be creating a Network Printer with the aid of the Raspberry Pi 3 and the almighty CUPS which makes it all possible.

CUPS (Common Unix Printing System) is a printing system for UNIX like operating systems based computers. It gives computers on which it is running the ability to act as a print server. A computer running CUPS is able to accept jobs from client devices, process them and pass it on to the appropriate printer to print.

Raspberry-Pi-Print-Server-using-CUPS.jpg


All most all printers are supported by CUPS especially HP printers since HP operates its own open source project. Other printer models that are not directly supported by CUPS may have generic drivers that are compatible which provides basic printing functions.

Required Components


For this tutorial, we will need the following components, some of which you may certainly have laying around and won’t need to buy.


  1. Raspberry Pi 3
  2. SD Card (8gb at least)
  3. USB printer
  4. Ethernet Cable
  5. Power Supply for the Pi
To proceed, we will be using the Raspbian stretch OS for this tutorial and since its setup is same as that of the Jessie, I will assume you are familiar with setting up the Raspberry Pi with the Raspbian stretch OS. I also want to assume you know how to ssh into the Raspberry Pi using a terminal software like putty. If you have issues with any of the things mentioned, there are tons of Raspberry Pi Tutorials on this website that can help, and you can also drop your questions in the comment box and I will do my best to respond.

Setting up Network Printer on Raspberry Pi:


This section will carry us through a series of steps that will culminate in the installation of CUPS on your Raspberry Pi.


Step 1: Upgrade the Pi


Kind of a ritual, first thing for all of my projects is updating the Raspberry Pi, by doing this you ensure your pi has all the latest updates to the OS you are working with.


To do this we use;

sudo apt-get update
sudo apt-get upgrade
With this done, reboot the pi using;

sudo reboot
Wait for the reboot process and login again


Step 2: Install Print Server Software CUPS


With the update done the next line of action is to install our print server software CUPS.


To do this run;

sudo apt-get install cups
This will take some time but will install CUPS and other dependencies like Samba, perl and several other software or libraries.


Step 3: Configure CUPS


With Installation done, its time to check out the configuration file of CUPS. Several settings that generally affect how cups works, like the port on which cups communicate which is by default 631, port can be changed here.


The config file can be accessed using;

sudo nano /etc/cups/cupsd.conf
Change/add the following lines to the configuration file.

# Only listen for connections from the local machine.

#Listen localhost:631

#CHANGED TO LISTEN TO LOCAL LAN

Port 631

# 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>

Save the file using ctrl+X followed by y and then enter.


After saving, restart CUPS to effect the changes to the configuration file using;

sudo service cups restart

Step 4: User Access Settings


Next we add the Pi user to the Ipadmin group. This gives the Raspberry Pi the ability to perform administrative functions of CUPS without necessarily being a super user.

sudo usermod -a -G Ipadmin pi

Step 5: Network Accessibility


Next we need to ensure that CUPS can be connected to on the home network and its also accessible across the entire network.


To get it to allow all connections on the network, run;

sudo cupsctl –remote-any
After this we then restart cups to effect changes using;

sudo /etc/init.d/cups restart
With this done we can proceed to test if it works effectively by checking out the CUPS homepage.

Open a web browser and type in your Pi’s IP address, indicating the cups port.

e.g 192.168.137.147:631

631 is the cups port.

You should see the cups homepage like the image below.
Common-Unix-Printing-System-CUPS-homepage.png


Now on the home page, click on the administration tab.
This will take you to the administration page where you will see add new printer. Follow the prompts, select your printer server and continue.
Adding-a-Printer-to-CUPS-for-Raspberry-pi-print-server.png

On the final stage before clicking on continue, ensure you checked the “share this printer” check box.

With this you are all done, move the printer to the preferred location, fire up your Raspberry Pi and print away.

Oh before I forget (rushing to get some chicken, it’s Christmas), to add the new created network printer on your Windows PC, go to devices and printers, select “Add a printer
Adding-printer-to-windows-PC.png

Adding-printer-to-windows-PC-for-Raspberry-pi-print-server.png
 

Attachments

  • IMG_20201224_121910.jpg
    IMG_20201224_121910.jpg
    148.2 KB · Views: 161
Though I might not need the guide in immediate future, but great work

We genuinely need more such great guides and tutorials at TE.

Thanks man

I have a pi 4 ans using only pihole on it, planning to setup a personal email server and samba on it,
Would love to have guide like yours to set them up


The ones that are available all over tend to skip a lot or steps and no way to trouble shoot
 
Remote scanning needs to be setup with SANE (Scanner Access Now Easy) . I will post a separate guide for it as I forgot to reserve second post.
Have you setup a way to get the Rpi to mail the scanned document? How do you access the scanned docs in mobile devices? Network share?
 
Back
Top