Simple Ubuntu Server: Part 8 – Setting Up CUPS

This part is devoted to printing, and more specifically, how to setup a print server using CUPS (Common UNIX Printing System).

As usual, the first step it to download and install the package after you update your repositories. Depending on your internet speed and machine capabilities this may take a while.

sudo apt-get update
sudo apt-get install cups

Some other packages you may want are:

  • cups-bsd     # bsd commands for interfacing with cups
  • cups-client     # system V style client programs
  • cups-common     # common files for cups server and client packages
  • cups-pdf     # pdf writer backend for cups

Again, as usual, the initial setup is done by editing the configuration file after creating a backup copy.

sudo cp /etc/cups/cupsd.conf{,.orig}
sudo vi /etc/cups/cupsd.conf

The reason I said initial setup above is because its a royal pain in the ass (in my humble opinion anyway) to create, edit, manage and troubleshoot the CUPS prints via command line. It is much easier to use the web interface.

First up, your username will need to be part of the group, lpadmin, in order to have permission make changes to the CUPS server. In case you don’t remember, to add the user to a group, use the following command:

sudo usermod -a -G lpadmin john.doe

What you should do next is set CUPS so that it listens for connections from machines other than its own. This is accomplished by editing the Listen directives that starts on line 19.

By default, it only listens on the loopback address:

Listen localhost:631
-or-
Listen 127.0.0.1:631

You can listen on a LAN address and port:

Listen 192.168.1.105:631

You can listen on a bound hostname across all installed network interfaces:

Listen myubuntuserver:631

The changes I made to mine are shown below:

Listen defaults

Listen defaults

Listen modified

Listen modified

Next up, turn browsing on on line 24 to show shared printers on the network:

Browsing on

Browsing on

And under each of the Location tags, add the following line to allow access to the server:

Allow all

Note that you can also specify the subnet and range block instead:

Allow 192.168.1.0/24

My initial and modified entries look like this (note I could have substituted ‘all‘ for ‘192.168.1.0/24′ for my particular subnet):

Location access defaults

Location access defaults

Location access modifications

Location access modifications

As with just about everything else, you’ll need to restart the server to accept the new changes. Do so with the following command:

sudo service cups restart

Your web interface should now be up and running. To access it, simply type in the address in the address bar of a browser

http://192.168.1.105:631 (don't forget the port!)
CUPS web interface address

CUPS web interface address

And if everything is working properly, you will see the home page

CUPS homepage

CUPS homepage

Note that in order to make changes, you will need to login to the admin page

http://192.168.1.105:631/admin
Admin page address

Admin page address

And again, if everything is working properly, you will be prompted for the username/password of the administrator

Admin login

Admin login

From there, you can add printers, classes, manage jobs, server settings, etc. Remember that the home page has a lot of helpful hints.

Administration page

Administration page

If you need more/better/different drivers, I find the package gutenprint is very good. You can install it with the command

sudo apt-get install cups-driver-gutenprint

A couple extra command line notes/tips.

1. To get a listing of available printers on your system, issue the following command:

lpstat -p -d

2. To print to a printer, you can issue the following command:

lpr -P printername /path/to/filename
Tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.

Protected by WP Anti Spam