|< Day Day Up >|| |
RHEL 3 comes with one print service, the Common Unix Printing System (CUPS). It's the successor to the Line Print Daemon (LPD), which is no longer offered with RHEL 3 or Fedora Linux. However, Red Hat includes software that allows you to use a number of LPD commands to monitor and maintain printers.
You can configure printers directly through the CUPS configuration files in the /etc/cups directory. Alternatively, RHEL 3 includes two quality GUI tools that you can use to configure local and remote printers on your network. One is a Web-based interface, and Red Hat is focusing its efforts on its own Printer Configuration utility.
CUPS is the Linux/Unix implementation of the Internet Print Protocol (IPP). I expect IPP to become a fairly universal standard for printer configuration sometime in the future, even for Microsoft and Apple computers.
CUPS and a number of print databases are installed with the Printing Support package group. It includes ten RPM packages which appear unrelated. If you haven't already installed this package group during the RHEL 3 installation process, it's likely most efficient to install it using the Red Hat Package Management utility described in Chapter 4. If you want to learn to install the packages on your own, review the packages in the Package Management utility or the /usr/share/comps/i386/comps.xml file.
It's easy to start and configure CUPS to start when Linux boots on your computer. The cups service script works like most of the other services on RHEL 3. In other words, you can start it with the following command:
# service cups start
Naturally, by substituting restart, stop, or reload for start, you can restart or stop the CUPS service, or reload the CUPS configuration files.
There are a number of printer configuration files in the /etc/cups directory. Each of these files include a substantial number of commands and comments. I'm going to summarize some key commands in these files, which are listed in Table 8-2.
CUPS Configuration File
Specifies different classes of printers. A print class can include several printers; when you print to a print class, CUPS sends your print job to the first available printer in that class, as specified here.
Sets the default CUPS server for this computer; it can be local or another remote print server.
The main CUPS configuration file.
Includes file format filters, such as images and documents.
Sets file types that can be processed through CUPS printers.
Documents printers configured by the CUPS Web-based tool.
Includes a conversion filter which supports PostScript printers.
Adds a list of printers for sharing; used by Samba.
While I still believe that it's best in general to edit configuration files directly, the commands associated with CUPS can be difficult to learn. Several of the files in /etc/cups don't include the same quality of comments as other services. And the Red Hat configuration tool provides the functionality that you need-it's considerably better than the functionality of the Samba Server Configuration tool, for example.
The main Red Hat Printer Configuration tool works well. You can start it with the redhat-config-printer command, or you can click Main Menu | System Settings | Printing. Either option opens the utility shown in Figure 8-11. It is a 'front end' that can help you configure the files in the /etc/cups directory.
Figure 8-11: Red Hat's Printer Configuration utility
You can use this tool to manage printers. It can configure print queues to local ports or through remote systems:
Local CUPS ports
Remote Unix/Linux LPD print services
Shared Windows printers
Novell NCP print queues
HP JetDirect print servers
|On The Job|| |
Red Hat has developed a text-mode version of the Printer Configuration tool. You can start it from the text console with the redhat-config-printer-tui command.
Previous versions of Red Hat used the printtool GUI printer manager and the printconf-gui utility. These commands now are 'front-ends' which have been reconfigured to start the Printer Configuration tool. You should be able to use this tool to connect to just about any type of printer available on your network.
Now let's try defining a local printer. Click Add. This should automatically start the Add a New Print Queue wizard, as shown in Figure 8-12.
Figure 8-12: Starting the printer configuration process
Click Forward. In the Queue name screen shown in Figure 8-13, designate a name and comment for the printer. When you share printers over a network, the name and comment can help you identify the printer. The printer name must be one word. Click Next to continue.
Figure 8-13: Naming the printer
If you selected a local printer, the next step is to select a printer port. The normal default is the first printer port, /dev/lp0. This corresponds to LPT1: in the Microsoft world. You might see /dev/usb/lp0 for a printer on a USB port. This is the default option shown in Figure 8-14.
Figure 8-14: Selecting the printer connection
Alternatively, if you're configuring a printer over a network, click the Select A Queue Type drop-down text box. You'll get to choose between printers shared on several different types of networks, as described at the start of this section. If you select a network option, the window changes to allow you to enter network information. For example, if you select a Networked CUPS (IPP) printer, the window changes to Figure 8-15.
Figure 8-15: Configuring a CUPS network printer
In this setup, you'll need the hostname or IP address of the print server, the name of the printer, and any required usernames and passwords to authorize access to that network printer. Once you've identified the printer location, click Forward. There may be a slight delay as the tool looks through the network. Now you can select a printer manufacturer and driver, as shown in Figure 8-16.
Figure 8-16: Selecting a driver
There are two steps here. First, click the drop-down text box where you see Generic (Click To Select Manufacturer). You'll be able to choose between several dozen manufacturers. Once you select a manufacturer, the screen changes to a database of printer models associated with that manufacturer. Select a driver and then click Forward.
Before the Printer Configuration tool creates a print queue, it documents what it's about to do. If you're satisfied with the configuration, click Apply. This returns you to the main Printer Configuration menu shown previously in Figure 8-11, and an offer to print a test page. You have to select Yes to apply changes.
The main Printer Configuration menu should now include the name of your printer. To write these changes to the configuration files in the /etc/cups directory, as well as /etc/printcap, click the Apply button.
If you have trouble here, you may not have shared the CUPS printer at the server. To do so at the server, highlight the name of the printer that you want to share. Right-click on it and select Sharing in the pop-up menu that appears. This opens the Sharing Properties window named for the printer on the server. Under the Queue tab shown in Figure 8-17, activate the 'This queue is available to other computers' option. This works with the Printer Configuration tool included with RHEL 3 and Red Hat Linux 9.
Figure 8-17: Sharing a CUPS printer
Even though RHEL 3 uses CUPS, you can still control your print system with LPD commands. Three major commands are associated with the lpd service: lpr, lpq, and lprm. They are used to add print requests, list queued print requests, and remove print requests, respectively. One more command can help you administer one or more print queues: lpc.
To view all known queues, run the lpc status command; it implements the result shown in Figure 8-18. As you can see, the output helps you easily scan all configured print devices and queues.
Figure 8-18: Status of configured printers
|On The Job|| |
The lpc command that comes with CUPS does not support starting or stopping of print queues.
Any user can use lpr to send print requests to any local print queue. You can lpr any files to a queue, or you can redirect any output via lpr. If you wanted to print to the queue named color, you'd use a command such as lpr -Pcolor filename. Note there is no space between the -P switch and the name of the queue.
Note that your printer is no longer printing requests. Now let's queue up a new job. Issue these commands:
# lpq WinPrint1 is ready and printing Rank Owner Job Files Total Size active root 373 smbprn.000486.6JkBaq 10240 bytes 1st root 374 smbprn.000487.6JkBaq 10240 bytes 2nd root 376 smbprn.000488.6JkBaq 10240 bytes
Now you can delete the jobs of your choice by using the lprm command and job number:
# lprm 376
RHEL 3 includes two GUI front-ends on the GNOME desktop. They run one of the commands noted in this section and format it into a graphical interface. To view the printers that you've configured on the GUI, click Main Menu | System Tools | Print Manager. One example is shown in Figure 8-19.
Figure 8-19: GNOME Print Manager
Each of these printers may have a print queue. For example, Figure 8-20 illustrates the result after double-clicking on the LinuxHP print icon. You can review the print jobs waiting in the spool to print on the LinuxHP printer.
Figure 8-20: Typical print spool
Another way to configure CUPS is through the Web-based interface. Open up the browser of your choice on the local Linux computer. Direct it to the http://localhost:631 address to get to the main CUPS configuration menu. There are seven options atop the Administration menu:
ESP Brings you to the Easy Software Products home page at www.easysw.com. CUPS is officially one of their products, licensed under the Linux GPL.
Administration A basic interface that allows you to set up classes of printers, manage print jobs, and add or manage printers. You can also administer these features through the Classes, Jobs, or Printers options.
Classes Enables you to set up groups of printers together.
Help Provides extensive documentation.
Jobs Enables you to view and manage active print jobs.
Printers Enables you to manage existing printers and set up new printers.
Software Enables you to review the current version and upgrade if appropriate.
You can manage Classes, Jobs, and Printers from the Administrative menu. You can read the Help section on your own, and software upgrades to CUPS are not covered in this book. The heart of CUPS is in the Administrative menu. If you click on it, you're prompted to enter your administrative root username and password.
One drawback to CUPS is that RHEL 3 does not support the same extensive database of printers as you see in the Red Hat Printer Configuration tool. On the other hand, the Red Hat tool does not support the creation of printer classes.
|On The Job|| |
Other Linux distributions don't include Red Hat's Printer Configuration tool. Many do include extensive printer databases in the CUPS Web-based tool.
Once you've entered your administrative credentials, you'll see the Admin setup page shown in Figure 8-21. There are three sections here. Classes enable you to configure a group of printers together. When you use a specific class, CUPS directs your print job to the first available printer in this class. Jobs help you manage the print jobs currently in the print queue. Printers allow you to add new printers and manage existing printers.
Figure 8-21: CUPS Admin menu
As the Red Hat Printer Configuration tool is superior (in my opinion, on a Red Hat computer), I won't explain the Add Printer menu in this book. However, if you want to create a printer class, the CUPS Web-based tool is the easiest way to go. As described earlier, a CUPS printer class allows you to print to a group of printers. CUPS then selects the first available printer in that class.
To proceed, click Add Class. You're taken to a menu where you need to fill in three text boxes, as shown in Figure 8-22:
Figure 8-22: Configuring a printer class
Name The name of the printer class. If you want to print to this printer group, you'll call or connect to this printer class name.
Location Must be set to the name or IP address of the local print server.
Description Allows you to add the comment of your choice to help identify the printer class.
After you click Continue, you'll get to include one or more configured printers in your printer class. Do so, and click Continue. The CUPS Web-based tool now creates a print class, as shown in Figure 8-23.
Figure 8-23: Your new printer class
Once you've configured security for a CUPS printer, you can verify it in /etc/cups/cupsd.conf. The security commands in this file are fairly straightforward. By default, access to a CUPS printer is limited to the local computer with a stanza such as:
<Location /printers/printer> Order Deny,Allow Deny From All Allow From 127.0.0.1 AuthType None </Location>
If you configure a CUPS printer to be shared with the world, you'll see one more command in the stanza. For example, printer2 is shared with the world because of the command in bold:
<Location /printers/printer> Order Deny,Allow Deny From All Allow From 127.0.0.1 AuthType None Allow From All </Location>
Naturally, you can limit access to specific IP address networks. For example, to limit access to the 192.168.30.0 LAN, you'd substitute the following command for Allow From All:
Allow From 192.168.30.0/255.255.255.0
You can also substitute computer or domain names. For example, the following command allows access from the example.com domain:
Allow From *.example.com
You can't configure these limits using the Red Hat Printer Configuration utility (redhat-config-printer). If you want to set up host-based security in this way, you'll have to edit the cupsd.conf configuration file directly.
|< Day Day Up >|| |