Setting Up Printers


Most parallel printers and USB printers can be detected and set up using the Printer configuration window. However, the Printer configuration window also lets you configure Fedora or RHEL so that you can use printers that are available on your LAN as a Windows printer (Samba), AppleSocket or HP JetDirect, Internet Printing Protocol (IPP) printer, or UNIX printer (LPD or LRP daemons).

Using the Printer Configuration Window

To install a printer from your desktop, use the Printer configuration window ( system-config-printer 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). After a printer is configured, users on your local system can use it. Following 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 locally to your computer (as on a parallel or USB port) or to another computer on the network (for example, from another UNIX system, Windows system, or NetWare server).

Configuring Local Printers

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.)

Tip 

You should connect your printer before starting this procedure. With the printer connected, the Printer configuration window might be able to scan for the printer to determine the printer's location and to test the printer immediately when you have finished adding it.

Adding a Local Printer

To add a local printer, follow these steps as root user :

  1. Make sure that the CUPS service (cupsd daemon) is running. Just to make sure, type:

     #  service cups restart  
  2. To open the Printer configuration window, either select System Administration Printing from the panel or type the following as root user from a Terminal window:

     #  system-config-printer &  

    The Printer configuration window appears, as shown in Figure 17-1. Note that printers detected on the local system will appear under the Local Printers entry.

  3. Click New Printer. A New Printer window appears.

  4. Add the following information and then click Forward:

    • Printer 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 model name and features (an HP LaserJet 2100M with PCL and PS support)

    • Location - Indicate its location (in Room 205 under the coffee pot)

    In this example, my HP Laserjet 2100 and HP Deskjet 5550 printers were detected (as you will see later). One is detected on the computer's parallel port (HP Laserjet 2100) and one is detected on a USB port (hp deskjet 5550).

  5. If the printer you want to configure is detected, simply select it and click Forward. If it is not detected, choose the device to which the printer is connected ( LPT #1 and Serial Port #1 are the first parallel and serial ports, respectively) and click Forward. (Type /usr/sbin/lpinfo -v less from a shell to see all available ports.)

    You are asked to identify the printer's driver.

  6. To use an installed driver for your printer, choose Select Printer From Database, and then choose the manufacturer of your printer. As an alternative, you could select Provide PPD File and supply your own PPD file (for example, if you have a printer that is not supported in Linux and you have a driver that was supplied with the printer. Select Forward to see a list of printer models from which you can choose.

  7. Select the printer model for your printer. If there are multiple drivers avaialable for the model, you can choose which one you want from the Drivers box.

    Tip 

    If your printer doesn't appear on the list but supports PCL (which is HP's Printer Control Language), select from one of several generic PCL drivers. 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.

  8. With your printer model selected, click the Printer, Driver, or PPD buttons at the bottom of the screen. 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. Click Forward to continue.

  9. If the information looks correct, click Apply to create the entry for your printer. You are returned to the Printer configuration main window, with the new printer listed under Local Printers.

  10. Click the name of the printer you just added, then click Print Test Page. (Click OK 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).

    To further configure the printer, using the tabs that appear to the right of the selected printer, continue to the Editing a Local Printer section.

image from book
Figure 17-1: Add printers connected locally or remotely with the Printer configuration window.

Printing should be working at this point for users who are printing from your local computer. (If you want to share this printer with other computers on your network, refer to the "Configuring Print Servers" section of this chapter.)

Editing a Local Printer

After you have added a local printer, you can edit the printer definitions to change how that printer behaves. Select the printer you want to edit from the left column and settings for that printer appear to the right, as shown in Figure 17-2.

image from book
Figure 17-2: Change printer settings, policies and access from the Printer Configuration window.

With the printer you want to configure selected, choose from the following tabs to change its configuration:

  1. Settings - The Description, Location, Device URI, and Make and Model information you created earlier are displayed on this tab. The following bullets describe how to change options besides those you added originally:

    • State - Select check boxes to indicate whether or not the printer will print jobs that are in the queue (Enabled), accept new jobs for printing (Accepting Jobs), or be available to be shared with other computers that can communicate with your compter (Shared).

    • Make Default Printer - Select this button to have the printer be the default printer.

  2. Policies - Click the Policies tab. From this tab, you can set the following items:

    • Banner - Add banner pages at the beginning 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.

    • Policies - In case of error, the stop-printer selection causes all printing to that printer to stop. You can also select to have the job discarded (abort-job) or retried ( retry -job) in the event of an error condition.

  3. Access control - If your printer is a shared printer, you can select this tab to create a list of users that is either allowed access to the printer (with all others denied) or denied access to the printer (with all others allowed).

  4. Printer Options - Click Printer Options to set defaults for options related to the printer driver. The available options are different for different printers. Many of these options can be overridden when someone prints a document. Here are a few of the options you might want to set:

    • Watermark - There are several Watermark settings that let you add and change watermarks on your printed pages. By default, Watermark and Overlay are off (None). By selecting Watermark (behind the text) or Overlay (over the text), you can set the other Watermark settings to determine how watermarks and overlays are done. Watermarks can go on every page (All) or only the first page (First Only).

      Select Watermark Text to choose what words are used for the watermark or overlay (Draft, Copy, Confidential, Final, etc.). You can then select the font type, size , style, and intensity of the watermark or overlay.

    • Resolution Enhancement - You can use the printer's current settings or choose to turn resolution enhancement on or off.

    • Media Size - The default is U.S. letter size, but you can also ask the printer to print legal size, envelopes, ISO A4 standard or several other page sizes.

    • Media Source - Choose which tray to print from. Select Tray 1 to insert pages manually.

    • Levels of Gray - Choose to use the printer's current levels of gray or have enhanced or standard gray levels turned on.

    • 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.

    • EconoMode - Either use the printer's current setting or choose a mode where you save toner or one where you have the highest possible quality.

Note 

For a description of other driver options, refer to the CUPS Software User Manual ( /usr/share/doc/cups-*/sum.html ) under the Standard Printer Options heading.

Click Apply when you are satisfied with the changes you made to the local printer.

Configuring Remote Printers

To use a printer that is available on your network, you must identify that printer to your Fedora or RHEL system. Supported remote printer connections include Networked CUPS (IPP) printers, Networked UNIX (LPD) printers, Networked Windows (SMB) printers, Networked Novell (NCP) 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 Fedora or RHEL 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 Fedora and RHEL.

You can use the Printer configuration window to configure each of the remote printer types:

  1. From the Desktop menu, select System Administration Printing.

  2. Click New Printer. The New Printer window appears.

  3. Add the Printer Name, Description, and Location for the printer and click Forward. The Select Connection window appears.

  4. Depending on the type of ports you have on your computer, select one of the following:

    • LPT #1 - For a printer connected to your parallel port.

    • Serial Port #1 - For a printer connnected to your serial port.

    • AppleSocket/HP JetDirect - For a JetDirect printer.

    • Internet Printing Protocol (IPP) - For a CUPS or other IPP printer.

    • LPD/LPR Host or Printer - For a UNIX printer.

    • Windows Printer via SAMBA - For a Windows system printer.

  5. Continue following the steps in whichever of the following sections is appropriate.

Adding a Remote CUPS Printer

After choosing to add an IPP (CUPS) printer from the Select Connection window, you must add the following information to the window that appears:

  • Hostname - The host of the computer to which the printer is attached (or otherwise accessible). This can be an IP address or TCP/IP hostname for the computer (the TCP/IP name is typically accessible from your /etc/ hosts file or through a DNS name server).

  • Printername - The printer name on the remote CUPS print server, which might look something like /printers/HP722C . 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.

Adding a Remote UNIX Printer

After you have selected to add an LPD/LPR (UNIX) printer from the Select Connection window, you must add the following information to the window that appears:

  • Hostname - The hostname 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 typically accessible from your /etc/hosts file or through a DNS name server). The host computer might be a UNIX or Linux print server running the lpd print daemon.

  • Printername - The printer name on the remote UNIX computer.

Although CUPS is the more popular printing system for Linux and UNIX systems today, some UNIX-like systems still use the Berkeley LPR print spooler system (see RFC1179). Early Red Hat Linux systems included LPRng print spooling software to provide this same interface for managing print servers ( lpd daemon). So, to print to an old Red Hat system at your location, you might need to identify a printer there as a UNIX printer. For older clients , CUPS can also act like an LPD print spooler (see the bullet on enabling LPD-style printing in the "Configuring a shared CUPS printer" section later in this chapter).

Complete the configuration as you would for a local printer.

Tip 

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 of the UNIX printer to add your host name to the /etc/lpd.perms file. (Type lpq -P printer to see the status of your print job.)

Adding a Windows (SMB) Printer

Enabling your computer to access an SMB printer (the Windows printing service) involves adding an entry for that printer in the Select Connection window.

Note 

Before you can add an SMB printer queue to Linux, you must first have configured that printer to work on the Windows machine. You must also indicate that the printer can be shared and is accessible to your Linux machine on your LAN.

After you have selected Windows Printer via SAMBA to the Select Connection window (described previously), you are presented with a list of computers on your network that have been detected as offering SMB services (file or printing service). You can:

  • Select the group (click the arrow next to the group you want)

  • Select the server (click the arrow next the server you want).

  • Select the printer from the list of available printers shown.

Alternatively, you could identify a server that does not appear on the list of servers. Type a server name and share into the smb:// box at the top of the page. For example, you could type:

 smb://  MYGROUP/EINSTEIN/hp2100m  
Tip 

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.

Next, enter a username and password, if that is required to access the shared printer:

  • Username - 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.

Caution 

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 is new entries in the /etc/cups/cupsd.conf and printers.conf files. This /etc/cups/printers.conf entry shows the printer entry you just created:

 <Printer NS1-PS> Info Location HP on ns1 DeviceURI smb://jjones:my9passswd@FSTREET/NS1/hp State Idle Accepting Yes Shared 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 an 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  
Tip 

If you are receiving failure messages, make sure that the computer to which you are printing is accessible. For the previous example, 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.

Adding a JetDirect Printer

A JetDirect printer (AppSocket/HP JetDirect) is one that is connected directly to your Ethernet network via a JetDirect device. You typically use port 9100 to print to a JetDirect printer, although additional interfaces may use ports 9101, 9102, and so on. To use a JetDirect printer from Fedora or RHEL, enter the following information:

  • Hostname - Enter the name of the JetDirect printer.

  • Port number - Enter the port number (typically 9100) to identify the interface to the JetDirect printer.

Using Web-Based CUPS Administration

The Printer configuration window effectively hides the underlying CUPS facility. There may be times, however, when you want to work directly with the tools and configuration files that come with CUPS. The following sections describe how to use some special CUPS features.

Caution 

Plain-text configuration files are at the base of the CUPS printing facility. When different tools, such as the CUPS Web-based interface and Printer Configuration window, manipulate the same config files, those files can become unusable by the other tools. When possible, you should use the system-config-printer (Printer configuration window) to work with printers in Fedora and RHEL. You will see warnings to this effect if you start to use the CUPS interface.

Although the preferred way to configure CUPS printing in Fedora or RHEL is with the Printer configuration window, CUPS offers its own Web-based administrative tool.

If CUPS is already running on your computer, you can immediately use CUPS Web-based administration from your Web browser. If CUPS is not running yet, refer to the following section describing the cupsd daemon for information on starting it.

CUPS listens on port 631 to provide access to the CUPS Web-based administrative interface. On the local computer, type the following into your Web browser's location box:

  http://localhost:631/admin  

A screen similar to the one shown in Figure 17-3 appears.

image from book
Figure 17-3: CUPS enables Web-based administration via port 631

By default, Web-based CUPS administration is available only from the localhost. To access Web-based CUPS administration from another computer, you must change the /admin section in the /etc/cups/cupsd.conf file. As recommended in the text of this file, you should limit access to CUPS administration from the Web. Also keep in mind that passwords are passed as clear text, so someone sniffing your network could see your password. Consider accessing this service through an ssh tunnel if you want to do CUPS administration over an insecure network.

In the following example, I tell CUPS to listen on its LAN interface for outside connections (in this example, the IP address of eth0 is 10.0.0.20 ). I changed BrowseAllow to ALL . I then added Allow lines to allow access from a host from IP address 10.0.0.5 for the root of the server ( / ), /admin , and /admin/conf , as shown in the following example.

  Listen 10.0.0.20   BrowseAllow ALL  <Location /> Order allow,deny Allow localhost  Allow 10.0.0.5  </Location> <Location /admin>  #  Encryption Required Order allow,deny Allow From 127.0.0.1  Allow From 10.0.0.5  </Location> <Location /admin/conf> AuthType Basic Require user @SYSTEM Order allow,deny Allow localhost  Allow 10.0.0.5  </Location> 

From the computer at address 10.0.0.5 , I typed the same line shown above in my Web browser (substituting the CUPS server's name or IP address for localhost). When prompted, I entered the root user name and password.

Now, with the Admin screen displayed, you can set up a printer as follows :

  1. Click the Add Printer button. The Add New Printer screen appears.

  2. Type a Name, Location, and Description for the printer and click Continue.

  3. Select the device to which the printer is connected. The printer can be connected locally to a Parallel, SCSI, Serial, or USB port directly on the computer. Alternatively, you can select a network connection type for Apple printers (AppSocket/HP JetDirect), Internet Printing Protocol (http or ipp), or Window printer (using SAMBA or SMB).

  4. If prompted for further information, you may need to further describe the connection to the printer. For example, you may need to enter the baud rate and parity for a serial port or you might be asked for the network address for an IPP or Samba printer.

  5. Select the make of the print driver (if you don't see the manufacturer of your printer listed, choose PostScript for a PostScript printer or HP for a PCL printer). For the make you choose, you will be able to select a specific model.

  6. If the printer was added successfully, the next page you see should show a link to the description of that printer. Click that link. From the new printer page, you can print a test page or modify the printer configuration.

After you are able to print from CUPS, you can return to the CUPS Web-based administration page and do further work with your printers. Here are a few examples:

  • List print jobs - Click Manage Jobs to see what print jobs are currently active from any of the printers configured for this server. Click Show Completed Jobs to see information about jobs that are already printed.

  • Create a printer class - Click Manage Classes; then click Add Class and identify a name and location for a printer class. Click Continue. Then, from the list of printers configured on your server, select which ones will go into this class.

  • View printers - You can click Manage Printers and view the printers you have configured. For each printer that appears, you can click Stop Printer (to stop the printer from printing, but still accept print jobs for the queue), Reject Jobs (to not accept any further print jobs for the moment), or Print Test Page (to print a page). Figure 17-4 shows the Printers page.

image from book
Figure 17-4: Temporarily stop printing or print test pages from the Printers page.

Configuring the CUPS server (cupsd.conf)

The cupsd daemon process listens for requests to your CUPS print server and responds to those requests based on settings in the /etc/cups/cupsd.conf file. The configuration variables in cupsd.conf file are in the same form as those of the Apache configuration file ( httpd.conf ).

The Printer configuration window adds access information to the cupsd.conf file. You can step through the cupsd.conf file to further tune your CUPS server. Here are a few suggestions:

 Classification topsecret 

No classification is set by default. With the classification set to topsecret , you can have Top Secret displayed on all pages that go through the print server. Other classifications you can substitute for topsecret include: classified , confidential, secret , and unclassified .

 ServerCertificate /etc/cups/ssl/server.crt ServerKey /etc/cups/ssl/server.key 

The ServerCertificate and ServerKey lines (commented out by default) can be set up to indicate where the certificate and key are stored, respectively. Activate these two lines if you want to do encrypted connections. Then add your certificate and key to the files noted.

 Browsing On BrowseProtocols cups BrowseOrder Deny,Allow BrowseAllow from @LOCAL BrowseAddress 255.255.255.255 Listen *:631 

Browsing is the feature whereby you broadcast information about your printer on your local network and listen for other print servers' information. Browsing is on by default, but only for the local host ( @LOCAL ). You can allow incoming CUPS browser information for additional selected addresses. Browsing information is broadcast, by default, on address 255.255.255.255 .

To enable Web-based CUPS administration, the cupsd daemon listens on port 631 for all network interfaces to your computer based on this entry: Listen *:631 .

 BrowseRelay s  ource-address destination-address  

By turning on BrowseRelay (it's off by default), you can allow CUPS browse information to be passed among two or more networks. The source-address and destination-address can be individual IP addresses or can represent network numbers. This is a good way to allow users on several connected LANs to discover and use printers on other nearby LANs.

You can allow or deny access to different features of the CUPS server. An access definition for a CUPS printer (created from the Printer configuration window) might appear as follows:

 <Location /printers/ns1-hp1> Order Deny,Allow Deny From All Allow From 127.0.0.1 AuthType None </Location> 

Here, printing to the ns1-hp1 printer is allowed only for users on the local host ( 127.0.0.1 ). No password is needed ( AuthType None ). To share this printer with any remote machine that has access to it, you could add Allow From All just before the </Location> line.

If you change any of the settings in the cupsd.conf file, you must reload the CUPS service to have the changes take effect. As root user, type service cups reload . (The reload option reads the new configuration without restarting the daemon.)

Configuring CUPS Printer Options

When a new printer is created from the Printer configuration window, that printer is defined in the /etc/cups/printers.conf file. Here's an example of a printer definition in printers.conf :

 </Printer hp> <DefaultPrinter printer> DeviceURI parallel:/dev/lp0 Location HP LaserJet 2100M in hall closet State Idle Accepting Yes JobSheets none none QuotaPeriod 0 PageLimit 0 KLimit 0 </Printer> 

This is an example of a local printer that serves as the default printer for the local system. The most interesting information relates to the DeviceURI , which shows us that the printer is connected to parallel port /dev/lp0 . The State is Idle (ready to accept printer jobs) and the Accepting value is Yes (the printer is accepting print jobs by default).

The DeviceURI has several ways to identify the device name of a printer, reflecting where the printer is connected. Here are some examples listed in the printers.conf file:

 DeviceURI parallel:/dev/plp DeviceURI serial:/dev/ttyd1?baud=38400+size=8+parity=none+flow=soft DeviceURI scsi:/dev/scsi/sc1d6l0 DeviceURI socket://  hostname  :  port  DeviceURI tftp://  hostname  /  path  DeviceURI ftp://  hostname  /  path  DeviceURI http://  hostname  [:  port  ]/path DeviceURI ipp://  hostname  /  path  DeviceURI smb://  hostname  /  printer  

The first three examples show the form for local printers ( parallel, serial , and scsi ). The other examples are for remote hosts. In each case, hostname can be the host's name or IP address. Port numbers or paths identify the locations of each printer on the host.

Tip 

If you find that you are not able to print because a particular printer driver is not supported in CUPS, you can set up your printer to accept jobs in raw mode. This can work well if you are printing from Windows clients that have the correct print drivers installed on those clients. To allow raw printing in CUPS, uncomment the following line from the /etc/cups/mime.types file in Linux:

 application/octet-stream 

And uncomment the following line from the /etc/cups/mime.convs file:

 application/octet-stream 

After that, you can print files as raw data to your printers without using the -oraw option to print commands. As an alternative, you can just select the Raw Print Queue driver when you first configure printing through the Printer configuration window.




Fedora 6 and Red Hat Enterprise Linux Bible
Fedora 6 and Red Hat Enterprise Linux Bible
ISBN: 047008278X
EAN: 2147483647
Year: 2007
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net