Installing a printer

Most Linux distributions install printer support during the installation. However, this can be done afterwards by doing this three-step process:

  1. Verify your printer compatibility. If your printer is not going to work with Linux, it's best to know that before going any further.
  2. Install kernel support for printing.
  3. Install, if necessary, and configure the lpd system. Most Linux distributions preinstall the lpd system, but most likely you will need to configure it.

Step 1: Verify Printer Compatibility Realatively speaking, Linux can support any printer that you can plug into a serial, USB or parallel port. However, you may not get a high-quality print-out or even useful output from some printers.

Linux prefers to print to a PostScript printer. However, most Linux users do not have PostScript-capable printers. A lot of people have printers that use Hewlett-Packard's PCL (printer control language) or some other type of protocol for communication with the computer. Linux works with non-PostScript printers by using filters that translate PostScript output to a language that the printer can understand.

There are filters for just about every type of printer, the notable exception being the WinPrinter. If happen to own a WinPrinter, the truth is, you may not get it to work with Linux at all.

Step 2: Install Kernel Support for Printing Ever since kernel release 2.1.33, kernel support for printing has been provided by the paralell port device driver. This device driver can be, and usually is, compiled as several loadable modules: parport.o, parport_ pc.o, and parport_ probe.o. Every major Linux distribution includes these modules in a subdirectory of /lib/modules and dynamically loads the modules when needed.

To make sure your kernel has the needed modules available, log in as root in the command line and issue the command: modprobe parport

If the command displays an error message stating that it's unable to locate the requested module, you will need to either to replace your kernel or reinstall Linux. Uh Oh! Time to get help from our Installation Howto page or the Kernel-Howto.

Just for your information, several recent releases of Red Hat do not contain proper module-configuration information for the parallel-port driver. Make sure that your /etc/ conf.modules file contains the line:

alias parport_lowlevel parport_pc

If it does not contain that line, you will get the message "no such device" when you print.

Step 3: Install and Configure the lpd System Just about every major Linux distribution installs the lpd system as part of the base install. So, unless you've removed the lpd system from your computer's hard drive, you just need to configure it. To make sure that the lpd system has been installed, issue this command:

When you do this, you should see output that describes the current state of the lpd system. For example, you may see the output no entries, which tells you that no files are waiting to be printed.

If the lpq command displays an error message, you will need to reinstall the lpd system. Be sure to see your distribution documentation for help in identifying the proper package.

To configure the lpd system, you will need to look over the contents of the /etc/printcap file. Many distributions provide tools to help you in doing this. For example, the Red Hat distribution provides the printtool program.

It's quite easy to revise the /etc/ printcap file using a text editor. First, make a copy of the file by issuing the command:

cp /etc/printcap /etc/

By making this backup copy of the original file (name, you'll be able to recover the file if you happen to make a mistake or two while editing. Some printer-configuration tools are easily confused by manual edits of the printcap file, so if your system contains such a tool, it's best to use it instead of editing the file.

Entries in the printcap file that have a hash mark (#) at the beginning of a line are comments, these are ignored by the lpd system. The rest of the lines specify the characteristics of the printer attached to your system. Below is a sample entry: lv:


The above entry specifies a printer named lv (this is the printer to which the lpr command sends output). The second line specifies the name of the spool directory where the printer daemon (lpd) will keep copies of files that are waiting to be printed. The directory you should specify may vary, depending on what Linux distribution you are using. If you set it up correctly, you can locate the directory by issuing the command: locate lpd

Look at the output of the command for a line that looks similar to /var/spool/lpd/lv and use the directory name you find there. Don't try to create your own directory, because the access permissions have to be set correctly. If you can't find the proper directory, please see our Linux printing HOWTO.

A lot more configuration attributes are available. The average printer configuration will use sd and lp, and also sh and mx. Sample Two summarizes the most commonly used printer configuration attributes.