Printers

How do I... Set up a printer using the Common UNIX Printing System?

Setting up a printer is one of those jobs made very easy by modern Linux administration tools. One of those tools is the Common UNIX Printing System. CUPS is an amazingly simple tool to use and administer. Jack Wallen shows you how it works.

Users often have trouble setting up hardware in Linux because they simply aren't used to the way things are done in Linux. Setting up hardware is relatively simple (once you know where the tools are.) And setting up a printer is one of those jobs made very easy by modern Linux administration tools. One of those tools is the Common UNIX Printing System (CUPS). Once installed, CUPS is an amazingly simple tool to use and administer.

This blog post is also available in the PDF format as a TechRepublic Download.

Getting and installing

The easiest way to install CUPS is to fire up your package manager (such as Adept, Synaptic, Yumex, etc), do a search for CUPS, click it, and install it. Or, if you're more comfortable with the command line, you can run apt-get install cups or yum install cups.

Once installed, you will want to run the CUPS daemon with the command

/etc/rc.d/init.d/cupsys start

Or

/etc/init.d/cupsys start

Once it is started, you are ready to go.

Configuring your printer

CUPS is managed through a Web browser. So open up Firefox and point it to http://localhost:631 and you will find yourself on the CUPS main page (Figure A) on your system. And no, you do not have to have Apache installed for this to work.

Figure A

It's not exactly pretty, but from this page you can manage every aspect of your printer.
Now the first thing you want to do (after you have plugged in your printer and fired it up) is to click on the Add Printer button (from the front page of the CUPS Web tool). The first Add Printer dialogue (Figure B) is simple: Name, Location, and Description.

Figure B

You can not use a space, "/", or "#" symbol in the Name field.

These fields are exactly as you would expect them to be. These are not taken from a driver or from the machines' firm (or hard) ware. So fill out these fields and then click Continue.

The next step is to select a device to associate with the printer you are adding. This is where you actually select your printer (or printer type) from a list. As you can see, in Figure C my Samsung ML1710 was detected by the CUPS system.

Figure C

There are two instances of my Samsung ML1710. I will select the second because it was recognized as a USB printer.
The next step selects the PPD file for the device. A PPD file is the Postscript Printer Device file that describes the fonts, paper sizes, resolutions, etc that the printer can handle. As you can see, in Figure D, my ML1710 has a few entries (most of which are duplicates for some reason).

I will select the foomatic entry because foomatic (open source configurable printer filters) entries tend to be the most reliable of the PPD files. Now, if your device does not have a listed PPD file, fear not. You most likely can find a PPD file from either the included drivers, from device' manufacturer Web site, or from an online search. If you find one just upload it with the help of the browse button in the dialog shown in Figure C.

Once you have selected your PPD file click Add Printer at which point you will be prompted for a username and password. On an Ubuntu system I was able to get by with using my regular username and password. In some instances you may have to use the root user and password.

Once you have added the printer you will be redirected to the configuration page for that printer. The configuration page is broken up into five sections: General, Adjustment, Miscellaneous, Banners, and Policies. Each section has its own configuration options.

General

In the general section you are asked to configure some general, printer-specific features. On my ML1710 I can configure the options shown in Figure D.

Figure D

I will keep the default options because they suit my needs.

Adjustment

Figure E shows the Adjustment options. Again, these options will depend upon the type of printer you have added. Since I have added a laser printer I get options that relate to saving toner. These are crucial if you do a lot of printing and don't want to be replacing expensive toner every month.

Figure E

Halftoning algorithms are a very complex method of error diffusing in printing.

Miscellaneous

This section (Figure F) holds all of the options that don't belong in any other section. Here you can actually correct for high altitude and other options as they relate to your printer.

Figure F

Altitude correction only gives you options for high or low altitude. There should be an option for "No correction".

Banners

The Banners section (Figure G) allows you to select from six different starting and ending banners. These banners are: Classified, Confidential, Secret, Standard, Topsecret, or Unclassified. Or you can select None. These banners will be automatically added to the top and bottom (respectively) of every page printed.

Figure G

"None" is the default (and toner saving) option.

Policies

The policies section (Figure H is a bit more complex. Policies refer to configuring a printer such that a user would have to provide a password in order to use the printer or allowing use from only specified printers. The only configuration option available is to select a policy from the drop down. Of course you would have to create a policy (which is beyond the scope of this article) first. But if you have created policies, you can choose them from the list and apply them to the configured printer.

Figure H

As you can see there are two default policies available for this printer: Error Policy and Operating Policy.

Checking your printer

Once you have the printer added, the first thing you will want to do is check to make sure it is printing properly. To do this click on the Printers tab and you will see the newly added printer listed (Figure I).

Figure I

Here you can start, stop, reject and move jobs, set as default, and a number of other options.

If this is the only printer you have added it will be set as the default. If this is a second (or third) printer you will have the option as setting this printer up as the default. To do that, click Set As Default button.

Now, let's print a test page for this printer. Click the Print Test Page button and a test page should be immediately sent to your printer. You will get a quick banner page claiming a test page has been sent and then you will be redirected to the printer page.

If your test page prints successfully, congratulations, you have added a printer to a Linux-based computer.

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

1 comments
Larry the Security Guy
Larry the Security Guy

use the built-in printer management apps found in either the settings, system or control menus of most popular distributions. Remotely administering a printer via the GUI, however, does come in handy.