CUPS Server Setup

The preferred method for setting up a CUPS server is to use the web-based administration interface. Unlike GUI tools that were attached as an afterthought by a third party, the CUPS web interface is thoroughly integrated into the CUPS system and is as capable as any other configuration method (although CUPS has its share of third-party GUI tools as well). Command-line tools also exist for CUPS configuration if you're working in a nongraphical environment. Directly editing the configuration files is rarely ever necessary.

Web-Based Administration

Launch your web browser and point it at http://localhost:631/ to bring up the administration interface. You'll need to log in as root with the password for the root account on that machine. The toolbar across the top will bring you to the various items you'll need to configure. The Administration link is slightly redundant, bringing you a menu of the same options that the toolbar provides. The links on either end of the toolbar will take you to the web sites of Easy Software Products, the developers of the CUPS system, and the cups.org main web site. The Help link will bring up the extensive documentation available for CUPS. It'll be worth your time to peruse the available documentation, even if you don't read it in depth quite yet. The remaining links will take you to the tools for managing printers, classes, and print jobs.

From the Printers page you can add new printers or manage existing printers. When you click the Add Printer button, you'll be presented with a simple form requesting the name, location, and description of the new printer. The name of the printer is what you'll use to identify it when performing any administration. The location is any text string you want to use to describe the printer's physical placement, such as "East side of the building near the coffee maker." The description is any additional text you want to use to further identify the printer. After clicking the Continue button, you'll be given a chance to select the back end for your printer from the Device drop-down box. Selecting a local back end, such as a parallel port, will lead you to choosing a Make and Model for your printer so the correct filter can be applied. Alternatively selecting a remote print server will first prompt you to enter the location in the form of a uniform resource identifier (URI). A URI is a more general form of a URL, much like what you would use in your web browser. For example, if the remote print server is running lpd, you would specify the server name and queue name in the format lpd:/Iservernamelqueue.

Once you've finished, your printer will show up in the list on the Printer page. Selecting the Configure Printer button will let you fine-tune the specifics for that particular print device. You'll also have the option here to stop the printer or tell it to reject jobs. If you select Reject Jobs, the printer will stop accepting new print requests but will still finish the jobs already in its queue. Using this as a prelude to completely stopping the printer is a bit gentler on your users.

Configuring classes of printers is easy as entering the name, location, and description, and then selecting which printers should be a part of the class. Classes can be stopped and started as well as set to reject or accept jobs much the same way that individual printers can. Individual jobs can be put on hold or cancelled from the Jobs page.

Implicit classes will be created automatically when two servers point to a printer with the same name. These provide load balancing and failover without any special configuration needing to be performed on either the server or the client.

Command-Line Configuration

CUPS provides a number of command-line utilities to configure your server in the absence of a graphical environment. The most important tool in the suite is lpadmin. With this command you can create, remove, and manage printers and classes. The following table summarizes some of the most used options to lpadmin.

Option

Description

-h servername

Specifies the server if the machine on which you're running this command isn't the print server itself. This allows for remote administration of printers and print servers.

-p printername

Specifies the name of the printer you want to create or modify. This is needed with all other options except -d or -x.

-L location text

Specifies the location of the printer.

-D description

Provides additional text information about the printer.

-c class

Adds the printer to this class. If the class doesn't already exist, it will be created.

-r class

Removes the printer from the specified class. If the class is left empty, it, too, is removed.

Option

Description

-v URI

Specifies the device back end in URI form.

-u allow | deny: user, user

Changes user permissions for the printer. (See Critical Skill section 19.8 on setting user permissions.)

-vd printername

Changes the default printer to the one specified.

-x printername

Deletes the named printer.

-E

Starts the printer and sets it to accept print jobs.

An example is in order to show how this works, but before we get to that, let's introduce a couple of other useful commands. The lpinfo command is closely related to adding and modifying printers with lpadmin. When using the web interface you will be presented a list of options for printer model and back-end device. Using the command line, you may not be sure which models and devices are supported on a particular setup. The lpinfo command can list for you the models and devices that a particular server supports. Specifying the -m option to lpinfo will list the models (in the form of a path to the .ppd file) that you can pass to lpadmin's -m option. Likewise, specifying -v to lpinfo will list the back-end devices available to pass to lpadmin's -v option.

The lpstat command can be used to gather information on configured printers, classes, and pending print jobs. There are a number of options for selecting what output is returned from lpstat, and the man page will tell you all about them, but for our purposes we're just going to use the -s option. Using lpstat with the -s option will list the classes and printers that have been set up, along with the devices associated with each printer and will tell you which printer is the default. It's worth mentioning that the -t option will show you all information that lpstat is capable of displaying.

To illustrate how lpadmin is used, look at the following example. We're going to create a printer named asimov, which is an HP LaserJet 4 connected to the local parallel port, and make it part of the class named lasers. Then just for the purpose of illustration, we'll delete the printer. • __

Was this article helpful?

0 0

Post a comment