Linux/UNIX printing has always suffered from the lack of a standard printing system and interface. The Common UNIX Printing System (CUPS) is working to change that. In this article, I will cover the procedures for installing and configuring CUPS, and some GUI interfaces available for use with CUPS.
Compiling and installing CUPS
Download the CUPS source code into the /usr/src directory and unpack the source code with the command:
tar -zxvf cups-1.1.14-source.tar.gz
The cups-1.1.14 directory will be created when the source code is unpacked. The next step is to configure CUPS for a specific system.
There are several options to choose from when configuring CUPS. The following three options are useful when support for Internet-based printing is required.
- · Server location protocol (SLP) support
When SLP support is configured with CUPS, SLP directory services may be used on the network. SLP support makes it much easier to find network printers and to provide network-printing services to non-CUPS printers.
- · IPP notification support
When IPP notification support is enabled, IPP notification code is linked to CUPS. This feature allows CUPS to notify users when print jobs are finished, when printers run out of paper, etc.
- · Encryption support
Encryption support allows CUPS to encrypt print jobs and remote commands to be sent to printers. The Open secure sockets layer (OpenSSL) library must be installed to enable encryption support.
To configure CUPS with support for all three options, run this command.
To configure CUPS with the default options, run the ./configure command with no options. Once CUPS is configured with the required options, build the software with the make command. Next, test the compiled software with the make test command. If the make test command reports All Tests Have Run Successfully, install CUPS with the command make install.
Use the command /usr/sbin/cupsd to start the CUPS daemon. Now it’s time to add printers to the system.
Adding printers to a CUPS system
There are two methods available for adding printers to a CUPS system:
- · Use the /usr/sbin/lpadmin utility from the command line.
- · Use the CUPS Web interface.
Adding printers using the lpadmin utility
Printers are added and configured from the command line by running the /usr/sbin/lpadmin command. Table A lists the options available with the lpadmin utility.
|-I||This is used to set a System V interface for the printer. It is used to provide support for legacy drivers.|
|-o name=<name>||This is used to set a PPD or server option for the printer.|
|-o job-k-limit=<size-limit>||This sets the per-user quota in kilobytes.|
|-o job-page-limit=<page-limit>||This sets the per-user page limit. The value is the maximum number of pages that can be printed.|
|-u||This allows user, user.|
|-u deny:user, user||This denies the user user.|
|-u allow: all||This allows all.|
|-u deny: none||This denies none.|
|-p||This is the printer’s name.|
|-E||This option enables the printer.|
|-v||This option sets the uniform resource identifier (URI) used by the printer.|
|-m||This option specifies the postscript printer description (PPD) used by the printer.|
Here are some examples of how the lpadmin command may be used. To add and enable an HP LaserJet printer connected to the system’s parallel port, use this command.
If a printer is connected to the system through a network interface, use the socket option when the URI is specified. For example, if the printer in the previous example is accessed through a Jet Direct interface at IP address 192.168.1.100, use this command.
Setting printer defaults
When the /usr/sbin/lpadmin command is used, any options you set are in effect only until the next print job is completed. To save printer and print job defaults, the /usr/bin/lpoptions command must be used. The options you have available will depend on the capabilities of the specific printer and how well it is supported. Table B shows the options available with the lpoptions command.
|-d dest / instance||Use this to set the default printer to dest. This option is used to override the current default printer for the user.|
|-h server||This specifies which CUPS server will be used.|
|-l||This option lists the options currently set for the printer.|
|– o option-value||Use this to set a new option for a named destination.|
|– p dest / instance||Use this to set the destination and instance for any options that follow this command.|
|-r||Use this to remove options for a named destination.|
|-x dest / instance||Use this to remove all options for a named destination and instance.|
Once the printer is connected to the system, the lpadmin and lpoptions commands are used to configure the default options.
The –o option may be used with either the lpadmin or lpoptions commands.
CUPS printers and print queues are administered through the lpadmin command. The format used with the lpadmin command is:
lpadmin -p <printer-name> -o <option-1> -o <option-2>
Here are some examples of how the lpadmin command may be used to set options for an HP LaserJet printer. Click here to see an example of how lpadmin sets the destination printer, the media type, and the page limit.
The printer location tells users where the printer is located. To set the location for the printer used in the finance department, use the command lpadmin -p laserjet -L “Finance laserjet”.
Every CUPS server must have a default printer. To make sure the finance department uses the HP LaserJet as its default printer, use the lpoptions -d laserjet command.
CUPS allows several different configurations to be applied to the same printer. Each individual configuration is referred to as an “instance.” To create an instance of a printer, the lpoptions command is used with this format.
For example, if Bob needs the HP LaserJet printer to print spreadsheets with landscape orientation on legal-size (8 œ x 14) paper, an instance of the HP LaserJet with these options would be created.
Bob could then print spreadsheets by accessing the spreadsheet instance of the HP LaserJet. The laserjet/spreadsheet instance could be accessed through an application Bob is using, with this command:
lpr –P laserjet/spreadsheet <filename>
Removing an instance
To remove the spreadsheet instance of the HP LaserJet, use thecommand lpoptions –x laserjet/spreadsheet.
Once CUPS is set up, the next step is to print the test page. To print the test page from the command line, use this command:
lpr –d <default-printer> /usr/share/cups/data/testprint.ps
Driver support for CUPS
One drawback to using a system like CUPS is the number of printers supported. A complete list of supported printers is available from the CUPS Web site.To provide support for additional printers, there are a couple of possible solutions. The first option is to check the printer manufacturer’s Web site. Several manufacturers provide postscript printer description (PPD) files that are compatible with CUPS. The next option is to use a precompiled printer driver package. These driver packages provide an overlay to an already existing printing system and are available as both commercial and open source packages.
Some of the most common driver packages include:
Print Pro is available from Easy Software and provides drivers for thousands of printers from almost all manufacturers. Print Pro is a commercial package produced by the same developers responsible for CUPS.
Gimp-Print is an open source project providing drivers for the most commonly used ink-jet printers, including Canon, Epson, HP, and Lexmark.
CUPS-o-matic is a free package available from the LinuxPrinting.org Web site. CUPS-o-matic provides a CUPS interface for Ghostscript printer drivers.
CUPS on the rise
There are a number of Linux distributions (Mandrake Linux being at the top of the list) that are now using CUPS as the default printing system. I look for the number of default installations to rise quickly in the future because CUPS is the one UNIX printing system that strives to be a universal, standards-compliant printing system.
Based on that fact alone, CUPS is already ahead of the current standard lpr. CUPS is not only very simple to use, but it is also very stable and, obviously, standards-compliant.