To install a printer from your desktop, use the Printer Configuration window (printconf-gui command). This tool enables you to add printers, delete printers, and edit printer properties. It also lets you send test pages to those printers to make sure they are working properly.
The key here is that you are configuring printers that are managed by your print daemon (cupsd for the CUPS service). Once a printer is configured, users on your local system can use it. After that, you can refer to the "Configuring Print Servers" section to learn how to make the server available to users from other computers on your network.
The printers that you set up can be connected directly to your computer (as on a parallel port) or to another computer on the network (for example, from another UNIX system, Windows system, or NetWare server).
Add a local printer (in other words, a printer connected directly to your computer) with the Printer configuration window using the following procedure. (See the "Choosing a Printer" sidebar if you don't yet have a printer.) Go to Edit a Printer to change the settings for an existing printer.
You should connect your printer before starting this procedure. This enables the printer software to autodetect the printer's location and to immediately test the printer when you have finished adding it.
To open the Printer Configuration, either select System Settings ? Printing from the main menu or type the following as root user from a Terminal window:
# printconf-gui &
The Printer Configuration window appears.
Click New. An Add a New Print Queue window appears.
Click Forward. The window that appears asks you to add a printer name and short description for the printer, as shown in Figure 17-1.
Figure 17-1: Add printers connected locally or remotely with the Printer configuration window.
Add the following information; then click Forward:
Name: Add the name you want to give to identify the printer. The name must begin with a letter, but after the initial letter, it can contain a combination of letters, numbers, dashes (-), and underscores ( _ ). For example, an HP printer on a computer named maple could be named hp-maple.
Description: Add a few words describing the printer, such as its features (an HP LaserJet 2100M with PCL and PS support) or its location (in Room 205 under the coffee pot).
The Queue type window appears.
Select Locally-connected, choose the device to which the printer is connected (/dev/lp0, /dev/usb/lp0, and /dev/ttyS0 are the first parallel, usb, and serial ports, respectively), and click Forward. (Type lpinfo -v | less to see all available ports.) Alternatively, you could do one of the following:
If your printer is not on the list because you have not yet connected it, you can connect it now and select Rescan Devices to have your computer try again to detect the printer.
If you intend to connect your printer later, or for some reason it's not being scanned, click Custom Device and specify the device name where the printer will be found.
The Printer Model window appears.
Click the arrow on the select manufacturer box, then choose the manufacturer of your printer. From the list that appears, select the printer model you have and click Forward. The Finish and Create the New Print Queue window appears.
If your printer doesn't appear on the list but supports PCL (which is HP's Printer Control Language), you can try selecting one of the HP printers (such as HP LaserJet). If your printer supports PostScript, you can select PostScript printer from the list. Selecting Raw Print Queue enables you to send documents to the printer that are already formatted for that printer type.
With your printer model selected, click the Notes button. In many cases, you will see good information from the Linux Printing Database about how your printer is configured and how to tune it further. (Close the information window when you are done.) Click Forward to continue.
If the information looks correct, click Apply; then click Finish to create the entry for your printer. You are asked if you want to print a test page.
Click Yes to print a test page. (Click Yes when told the test page has printed.) This test page will tell you interesting information about your printer, such as the resolution and the type of interpreter used (such as PostScript).
The printer will appear in the main Printer configuration window. If it is the only printer configured, a check mark will appear next to it, identifying it as the default printer. As you add other printers, you can change the default printer by selecting the one you want and clicking the Default button.
Choose Apply to save the changes (if necessary).
If you would like to try other test pages, click Test and select one of the following:
US Letter PostScript test page — Sends a letter-sized (8.5" x 11") page to the printer in PostScript format. If you have a color printer, the page appears in color.
A4 PostScript test page — Sends an A4 PostScript-formatted page to the printer.
ASCII Text Testpage — Sends plain text to the named printer.
Duplex test — Sends a test page to see if the printer is in half or full duplex.
JPEG test — Sends a JPEG image to the printer.
Printing should be working at this point. (If you want to share this printer with other computers on your network, refer to the "Configuring Print Servers" section of this chapter.)
After you have created a printer queue, you can edit the printer queue definitions to change how the printer behaves. From the Printer configuration window, do the following:
Edit — With your printer selected, click Edit. The Edit a Print Queue page appears. The following steps describe how to change options besides those you added originally.
Queue options — Click the Queue options tab. From this tab, you can:
Add banner pages at the beginning and/or end of a job. This is good practice for a printer that is shared by many people. The banner page helps you sort who gets which print job. The standard banner page shows the ID of the print job, the title of the file, the user that requested the print job, and any billing information associated with it.
Change the imageable area by setting all four side margins. The default is 36 points (one inch) on all four margins. You can adjust any of the four margins.
Add or remove filter options. These options define attributes of printing to the selected printer. Click the Add button to see queue options you can add. Options are stored in the /etc/cups/lpoptions file for each printer. Options that you might want to change include cpi (print text documents 10, 12, or 17 characters per inch) or lpi (print text documents 6 or 8 lines per inch). For descriptions of other options, look at the CUPS Internet Printing Protocol page (/usr/share/doc/cups-*/ipp.html).
Driver options — Click on Driver options to set defaults for options related to the printer driver. Many of these options can be overridden when someone prints a document. Here are a few of the options you might want to set:
Media Source — For multi-tray printers, you can select which tray to use by default.
Page Size — The default is U.S. letter size, but you can also ask the printer to print legal size, envelopes, or ISO A4 standard pages.
Resolution — Select the default printing resolution (such as 300, 600, or 1,200 dots per inch). Higher resolutions result in better quality, but take longer to print.
Printing Mode — Choose to print in grayscale or color.
Click OK when you are satisfied with the changes you made to the local printer.
To use a printer that is available on your network, you must identify that printer to your Red Hat Linux system. Supported remote printer connections include Networked CUPS (IPP) printers, Networked UNIX (LPD) printers, Networked Windows (SMB) printers, NetWare printers and JetDirect printers. (Of course, both CUPS and UNIX print servers can be run from Linux systems, as well as other UNIX systems.)
In each case, you need a network connection from your Red Hat Linux system that enables you to reach the servers to which those printers are connected. To use a remote printer, of course, requires that someone set up that printer on the remote server computer. See the section "Configuring Print Servers" later in this chapter for information on how to do that in Red Hat Linux.
You can use the Printer configuration window to configure each of the remote printer types:
From the Red Hat menu, select System Settings ? Printing.
Click New. The Add a New Printer Queue window appears.
Click Forward. The Queue Name window appears.
Type a short name and description of the printer and click Forward.
Click the Select a Queue Type box and select one of the following:
Networked CUPS (IPP)
Networked UNIX (LPD)
Networked Windows (SMB)
Networked Novell (NCP)
Next, continue following the steps in whichever of the following sections is appropriate.
After choosing to add a CUPS printer from the Printer configuration window, you must add the following information to the window that appears:
Server — The host of the computer to which the printer is attached (or otherwise accessible). This can be an IP address or TCP/IP host name for the computer (the TCP/IP name is accessible from your /etc/hosts file or through a DNS name server).
Path — The printer name on the remote CUPS print server. CUPS supports the concept of printer instances, which allows each printer to have several sets of options. So, if the remote CUPS printer is configured this way, you might be able to choose a particular path to a printer, such as hp/300dpi or hp/1200dpi. A slash character separates the print queue name from the printer instance.
Complete the rest of the procedure as you would for a local printer.
After you have selected to add a UNIX printer from the Printer configuration window, you must add the following information to the window that appears:
Server — The host name of the computer to which the printer is attached (or otherwise accessible). This is the IP address or TCP/IP name for the computer (the TCP/IP name is accessible from your /etc/hosts file or through a DNS name server).
Queue — The printer name on the remote UNIX computer.
Complete the configuration as you would for a local printer.
If the print job is rejected when you send it to test the printer, the print server computer may not have allowed you access to the printer. Ask the remote computer's administrator to add your host name to the /etc/lpd.perms file. (Type lpq -Pprinter to see the status of your print job.)
Enabling your computer to access an SMB printer (the Windows printing service) involves adding an entry for the printer in the Printer configuration window.
After you have selected to add a Windows printer to the Printer configuration window (described previously), you are presented with a list of computers on your network that have been detected as offering SMB services (file and/or printing service). You can:
Select the server (click the arrow next to its name so that it points down).
Select the printer from the list of available printers shown.
When prompted, fill in the user name and password needed to access the SMB printer. (You may also fill in the Workgroup, if required.) Click OK to continue.
Alternatively, you could identify a server that does not appear on the list of servers. Click the Specify button and input the following information in the appropriate fields:
Workgroup — The workgroup name assigned to the SMB server. Filling in the workgroup name isn't necessary in all cases.
If you are printing to a Windows 95/98 printer, you can find the Workgroup and Hostname of Print Server entries in the Network window. From Windows 95/98, choose Start ? Settings ? Control Panel. Open the Network window, and then click its Identification tab, which will display the computer name and workgroup. If there is no Identification tab, you may need to install the Client for Microsoft Networks client in the Network window.
Server — The server name is the NetBIOS name or IP address for the computer, which may or may not be the same as its TCP/IP name. To translate this name into the address needed to reach the SMB host, Samba checks several places where the name may be assigned to an IP address. Samba checks the following (in the order shown) until it finds a match: the local /etc/hosts file, the local /etc/lmhosts file, a WINS server on the network, or responses to broadcasts on each local network interface to resolve the name.
Share — The share name is the name under which the printer is shared with the remote computer. It may be different from the name by which local users of the SMB printer know the printer.
To find a remote printer name on most Windows systems, first go to the Printers folder (Start ? Settings ? Printers), and double-click the printer being shared. From the printer queue window that appears, choose Printer ? Properties, and then select the Sharing tab. The Sharing tab indicates whether the printer is shared and, if so, the name under which it is shared.
User — The user name is the name required by the SMB server system to give you access to the SMB printer. A user name is not necessary if you are authenticating the printer based on share-level, rather than user-level, access control. With share-level access, you can add a password for each shared printer or file system.
Password — The password associated with the SMB user name or the shared resource, depending on the kind of access control being used.
When you enter a User and Password for SMB, that information is stored unencrypted in the /etc/cups/printers.conf file. Be sure that the file remains readable only by root.
Complete the configuration as you would for a local printer.
The result are new entries in /etc/cups/cupsd.conf and printers.conf files. This /etc/cups/printers.conf entry shows the printer entry we just created:
<Printer NS1-PS> Info Created by redhat-config=printer 0.6.x DeviceURI smb://jjones:my9passswd@FSTREET/NS1/hp Location HP on ns1 State Idle Accepting Yes JobSheets none none QuotaPeriod 0 PageLimit 0 KLimit 0 </Printer>
The DeviceURI is the key information. A lot of information is packed into the DeviceURI line. It identifies the location as a smb object. The user name is jjones, with a password of my9passswd. The workgroup is FSTREET, the server is NS1, and the printer queue name is hp.
The contents of the cupsd.conf file define who you will allow to use this printer.
<Location /printers/NS1-PS> Order Deny,Allow Deny From All Allow From 127.0.0.1 AuthType None </Location>
Based on the information just shown, only users from the local host (127.0.0.1) are allowed to use the printer. No authentication is necessary for them to use it.
If everything is set up properly, you should be able to use the standard lpr command to print the file to the printer. With this example, you could use the following form for printing:
$ cat file1.ps | lpr -P NS1-PS
If you are receiving failure messages, make sure that the computer to which you are printing is accessible. For the example above, you could type smbclient -L NS1 -U jjones. Type the password (my9passswd, in this case). If you get a positive name query response after you enter a password, you should see a list of shared printers and files from that server. Check the names, and try printing again.
With this procedure, you set up your Red Hat Linux system to use a printer that is connected to (or otherwise managed by) a NetWare file and print server. As with SMB printing, you must gather the information about the server, queue, user, and password.
Select to add a Novell printer (Novell created NetWare) from the Printer configuration window (described previously), and then fill in the following information:
Server — The host name of the computer to which the printer is attached (or otherwise accessible). This is the NetWare Server name for the computer.
Queue — The name of the print queue on the NetWare server.
User — The user name required by the NetWare server system to enable access to the NetWare printer.
Password — The password associated with the user name.
Complete the configuration as you would for a local printer.