Prerequisites
For this setup we will need the following
- n
- Old computer on which we’ll install Ubuntu 22.04 / 20.04 (In this seup we’ll be using a 12 year old, headless PC with a dual core processor, 4GB RAM, 128GB SSD, 100Mbps NIC)
- A Working USB Printer from any leading brand (HP, Epson, Samsung, Canon etc) as drivers are easily available for them (In this setup we’ll be using HP MFP 1005)
- Basic knowlege of Command Line Interface
n
n
n
Introduction
n
We’ll start with setting up CUPS. CUPS (Common Unix Printing System) is the default printing system on Linux, FreeBSD, and macOS. Your Linux / macOS environment may have a dedicated printer configuration utility, but they all use CUPS under the hood.
Michael Sweet, started developing CUPS in the year 1997. In Feb 2007, Apple Inc hired him and purchased CUPS Source Code.
nn
We’ll be sharing CUPS Printer on the network via the following protocols
- n
- Bonjour + IPP: Bonjour, also known as mDNS/DNS-SD (multicast DNS/DNS service discovery), allows a computer to find services on the local network. IPP (Internet Printing Protocol) is the transport protocol.
- SMB: aka Samba, mainly used to share files and printers with Windows clients.
- AirPrint: Allows iPhone, iPad, and macOS clients to print over Wi-Fi.
n
n
n
These 3 protocols basically cover almost all the Operating Systems (iOS (AirPrint), Android, macOS, Linux, Windows) in use these days.
n
Connecting to Print Server
Connect the Print Server to your network via LAN Cable.
n
Connect your smartphone to the same network via WiFi.
n
Run a network scan via Fing app.
n
Note down the IP Address of the Print Server.
n
Ubuntu Server Edition has SSH installed by default, for Desktop Edition you’ll have to install OpenSSH Server from GUI with this command
sudo apt install openssh-server
Now ssh into the server with this command
ssh your_username@ip_address
your_username is the computer username you entered while installing Ubuntu.
n
ip_address is the IP Address you got with network scanner.
n
Enter the password when prompted.
n
Installing CUPS
Ubuntu desktop edition has CUPS pre-installed. If you use Ubuntu server edition, you need to run the following command to install CUPS from the default Ubuntu repository.
sudo apt install cups
Then start CUPS.
sudo systemctl start cups
Enable auto-start at boot time.
sudo systemctl enable cups
Check its status:
systemctl status cups
Sample output:
nn
Placeholder for Screenshot
nn
Next, edit the CUPS main configuration file with a command-line text editor like Nano.
sudo nano /etc/cups/cupsd.conf
First, we need to show shared printers on the local network. Find the following line.
Browsing Off
Change it to
Browsing On
so other computers in the same network can see printers connected to your Ubuntu computer.
n
By default, the CUPS web interface is only available at localhost:631. If you are running Ubuntu server edition, you may also want to make CUPS listen on all available network interface, so that you will be able to access the CUPS web interface from other computers. Find the following line.
Listen localhost:631
Change it to
Port 631
So CUPS will listen on all network interfaces. Then find the following lines.
n Order allow,denynn
The above configuration allows access to the CUPS web interface from localhost only. To allow access from other computers in the same network, add Allow @LOCAL to the configuration like below.
n Order allow,denyn Allow @LOCALnn
Also add it for the /admin directory to allow remote administration from local network.
n Order allow,denyn Allow @LOCALn
You can also allow a particular IP address like so:
n Order allow,denyn Allow 192.168.1.101nn
Save and close the file. Then restart CUPS for the changes to take effect.
sudo systemctl restart cups
Note that if you have enabled the UFW firewall on Ubuntu, you need to allow clients in the same network to access port 631 on your Ubuntu box. For example, my private network is using the 192.168.0.0 ~192.168.0.255 network range, so I run the following command.
sudo ufw allow in from 192.168.0.0/24 to any port 631
The CUPS web interface is available at https://ip_address:631. Add your user account to the lpadmin group in order to make changes in the CUPS web interface.
sudo adduser your_username lpadmin
n
Installing Printer Drivers in CUPS
n
Installing HP Printer Drivers is very straightforward
sudo apt install hplip
If You have any other printer like Epson, Canon, then install printer-driver-gutenprint package,
sudo apt install printer-driver-gutenprint
If you have other printers, you can find drivers on openprinting.org.
n
Setting up the Printer in CUPS
Next goto https://ip_address:631 on your web browser.
n
It will open up the CUPS Web Interface. Now add your printer in the “administration” section. Add Printer, Select your model from the list of available printers. Click Next and select the location where the printer will be kept physically (not mandatory though).
n
Next leave the default options as it is. Save and take a test print.
n
Share CUPS Printer via Bonjour/IPP Protocol, Avahi (AirPrint), Samba
n
…. To be continued