Setting up a printer on a Debian GNU/Linux PC using CUPS

Chris Lale

       chrislale@users.sourceforge.net

      

Revision History
Revision 0.0228 April 2004Revised by: cl
Added meta keywords. Moved 'About this document' to an appendix.
Revision 0.016th February 2004Revised by: cl
First release. Developed and tested using Debian GNU/Linux 3.0 (Woody) and the Debian package CUPS version 1.1.14-3. This document was composed using LyX qt version 1.3.3, exported to sgml and rendered to HTML using the newbieDoc style sheets and tools available from http://newbiedoc.sourceforge.net/tarballs/newbiedoc-lyx-files_0.02.tar.gz.

Table of Contents
1. Introduction
1.1. About lpr and lprng
1.2. About cups
1.3. Outline of the installation
2. Linux kernel support for printer port
2.1. Check parallel port
2.2. Check USB port
3. Install cups
3.1. Install cupsys and related packages
3.2. Install and configure the foomatic database (optional)
3.3. Install a .ppd file (optional)
4. Install a printer using cups
4.1. Log into cups using a web browser
4.2. Install the printer
5. Configure the printer using cups
5.1. Set default options for your printer
5.2. Test your printer from cups
6. Install an alternative front end for managing cups (optional)
A. Appendix
A.1. About installing Debian packages
B. Appendix
B.1. Managing printers using various browsers
C. Appendix
C.1. Kernel printer port support
C.2. Copyright information
C.3. Latest version
C.4. Bugs, errors and mistakes
C.5. Spelling, punctuation and grammar
C.6. Conventions used in this document

1. Introduction


1.2. About cups

cups is the Common UNIX Printing System it is a replacement for replacement for lpr and lprng. lpr or lprng will be removed, but your existing /etc/printcap file will remain on your system (unless you remove it using the purge option).

Each cups printer has a Postscript Printer Description (.ppd) file (see the Linux Dictionary at www.tldp.org/LDP/Linux-Dictionary/html/index.html).

You can find .ppd files for many printers using the Foomatic database (Debian packages foomatic-bin and foomatic-db).If you cannot find your printer there, you can download many .ppd files from http://www.linuxprinting.org/. A few manufacturers, such as Samsung, provide their own .ppd files. Visit your printer manufacturer's web site.

cups has an HTML front end. There are alternative front ends for cups available in the Debian 3.0 distribution such as gtklp (Gnome), qtcups (KDE) and xpp. This document describes the use of the HTML front end only.


1.3. Outline of the installation

NoteUse of # for remarks
 

The # character normally represents a command prompt. Here it indicates a comment line.

 

# Check for parallel port or USB support in the Linux kernel
dmesg | grep parport
dmesg | grep usb

# Install cups
apt-get install cupsys cupsys-bsd cupsys-client cupsys-driver-gimpprint cupsys-pstoraster libcupsys2

# Install foomatic
apt-get install foomatic-bin foomatic-db

# Use a browser to visit the local cups Admin web page
http://localhost:631/admin

# Log in to the cups Admin web page as root
User Name:
Password:
OK

# Install your printer in cups
Printers
Add printer 

# Configure your printer in cups
Printers
Configure Printer

# Test your printer from cups
Printers
Print Test Page

# Optional: install an alternative front end for managing cups
# gtklp (Gnome)
apt-get install gtklp
# or qtcups (KDE)
apt-get install qtcups
# or xpp
apt-get install xpp
   

2. Linux kernel support for printer port

You may already have printer port support in your kernel. If not, you must install the necessary kernel modules (see the appendix on setting up kernel printer port support). If your kernel does not allow modules, you should think about upgrading your kernel.

You can check for printer port support by looking at the boot messages using dmesg, and filtering the output using a pipe to grep.


2.1. Check parallel port

If you have a standard PC with a parallel port, the output should look something like this:

$ dmesg | grep parport
parport0: PC-style at 0x378 [PCSPP,EPP]
parport0: Printer, printer-name
parport_pc: Via x86A parallel port: io=0x378
lp0: using parport0 (polling).
$ 
   

Look for mention of parport0 and parport_pc. You would expect to see both if your kernel already supports a parallel printer.


2.2. Check USB port

WarningThis section is untested
 

I do not have a USB printer, so this is my 'best guess' at how to install one. If you get a USB printer working please let me know () and I will update this document.

You should get similar messages by grepping for USB ports using dmesg | grep usb. I have not been able to test this because I do not have a USB printer.

$ dmesg | grep usb
   

3. Install cups

Importantlpr or lprng will be removed.
 

Any existing system will be removed, but your printcap file will be retained. If you decide later to re-install lpr or lprng, should not need to create a new printcap file. If you are concerned, make a backup copy of /etc/printcap.


3.2. Install and configure the foomatic database (optional)

NoteThe foomatic database provides many.ppd printer drivers.
 

The cups package provides drivers for a few generic printers. You may find specific drivers for your printer from the manufacturer's web site or from www.linuxprinting.org/. You can skip this section if you already have a .ppd file for your printer.

Install foomatic and the PostScript filter 'Anything to Postscript' (a2ps).

$ su
Password: *******
# apt-get install foomatic-bin foomatic-db a2ps
   

You must choose a filter configuration. Read the details on the ncurses screens. Choose the default settings if you are not sure.

NoteNcurses navigation
 

Use the arrow keys and the <Tab> key to make your selection. Selected items are highlighted in blue. Use the <Enter> key to confirm your selection.

Debian Configuration
Foomatic Printfilter Configuration                                                             ...                                                                                            <Ok>
Debian Configuration
Foomatic Printfilter Configuration
...
Preserve manual changes when regenerating config files                                         parse
<Ok>  
   

You must select a PostScript filter. Select a2ps. Exit from user Root's account when you have finished.

Debian Configuration
Foomatic Printfilter Configuration 
...
a2ps
<Ok>
# exit
$
   

3.3. Install a .ppd file (optional)

NoteInstall a .ppd driver not provided by the foomatic package.
 

You can skip this section if you are not using one of the drivers provided by the foomatic package or one of the generic drivers provided by the cups package itself.

You may have a .ppd file from the manufacturer or from www.linuxprinting.org/. Alternatively (you might be in a hurry!), use one of cups' generic drivers.

Copy the file to /etc/share/cups/model, then stop and start the cups daemon to make cups use it. You must be Root to do this.

$ su
Password: *******
# cp path-to-filename.ppd /etc/share/cups/model/

# /etc/init.d/cupsys stop 
Stopping CUPSys: cupsd. 
# /etc/init.d/cupsys start
Starting CUPSys: cupsd.
Go back to being a normal user.
# exit
$
   

4. Install a printer using cups

4.1. Log into cups using a web browser

NoteBrowser variations
 

You can find login instructions for various browsers (both X and console based) in the appendix on using various browsers. The following instructions are as generic as possible.

Use a web browser to visit the cups Admin web page. Enter the name and password of the Root user when you are prompted.

http://localhost:631/admin
User name: root
Password:  *******
OK
   

4.2. Install the printer

Navigate to the Printers menu in the Admin main menu page. Choose to add a printer.

Admin main menu
   Printers menu
   Add printer
   

Enter a name, a location and a description for your printer.

The printer name may only contain letters, numbers, and the underline character. If this is your first (or only) printer, the name defaults to lp. This is a sensible choice because lp is recognised by cups as the default printer. The location is probably only useful if you have a network with printers in several places. It can be left blank. The description identifies the printer to people. Manufacturer and model number would be good choices here.

This is how you would add a new printer called printer-name. The model is printer-model, the manufacturer is printer-make and you are using the first parallel port on your computer (lp0).

Add New Printer dialog
   Name: printer-name
   Location:
   Description: printer-make printer-model
   Continue
   

The Device is the name of the printer port on your computer. This is often the parallel port but may be a USB port. Further detail on configuring your computer's ports is in the appendix about kernell printer support. Specify the make of your printer. If your printer is not listed, either install the foomatic package or supply a .ppd file from the manufacturer's web site or from www.linuxprinting.org/. (See the section on installing a .ppd file.)

Device for printer-name dialog
   Device: Parallel Port #1
   Continue
Model/Driver for printer-name dialog
   Make: printer-make
   Continue
   Model: printer-model
   Continue

Printer printer-name has been added successfully.
   

5. Configure the printer using cups

5.1. Set default options for your printer

Navigate to Admin main menu page. Find your printer's menu in the Printer menu page. Choose Configure Printer.

Admin menu
   Printer menu
      printer-name menu
      Configure Printer
   

You will probably want to configure the page size straight away. You can always make other configuration changes later.

Admin menu: Choose default options for printername. 
    Page size: A4
Continue

Printer printer-name has been configured successfully.
   

6. Install an alternative front end for managing cups (optional)

Some people prefer to manage their printers using a web browser. If you want an alternative X front end to cups, you can try these applications.

You can find out more about each application, or install them, using apt. For example, this is how you might find the details of the gtklp package and then install it.

$ apt-cache show gtklp
Description: Front end for cups written in gtk
...
$ su
Password: *******
# apt-get install gtklp
...
# exit
$
  


A. Appendix


B. Appendix

B.1. Managing printers using various browsers


B.1.2. galeon

Run galeon and open web location http://localhost:631/admin. Enter user Root's user name and password when prompted.

Galeon dialog
   Enter user name and password for "CUPS" at localhost:631
   User name root
   Password *******
   OK
   

B.1.4. lynx

Run lynx from a terminal or a terminal window. Go to the cups web page at http://localhost:631/admin. You may briefly see an error message before lynx asks for your user name and password.

$ lynx http://localhost:631/admin
Alert!: Access without authorization denied -- retrying
Username for 'CUPS' at server 'localhost:631': root
Password: *******
   

B.1.5. Elinks (links)

Do not forget to use the full URL including 'http://'

$ links http://localhost:631/admin
Unauthorized
   HTTP Authentication dialog
      Authentication required for CUPS at http://localhost:631/admin
      Login root
      Password *******
      OK
   


C. Appendix

C.1. Kernel printer port support


C.1.2. Parallel printer support


C.1.2.2. Select a module category

NoteNcurses navigation
 

Use the arrow keys and the <Tab> key to make your selections. Selected items are highlighted in blue. Use the <Enter> key to confirm your selection.

Select Category menu
   kernel/drivers/parport   Parallel port support.
   <Ok>
    

Loaded modules are tagged with a plus sign (+). You need two modules for a standard PC parallel port: parport and parport_pc.


C.1.2.3. Check the status of parallel port modules

You already have parallel port support if you see plus signs (+).

Select kernel/drivers/parport modules menu
   parport       + Parallel-port support
   parport_pc    + PC-style hardware
    

If either is flagged with minus signs (-), go straight on to the next section on installing parallel port modules.

If both modules are already installed, exit from the menu, exit from modconf and exit from the Root user's account.

Select kernel/drivers/parport modules menu
   Exit    Finished. Return to previous menu.
   <Ok>
Select Category menu
   Exit    Finished. Return to previous menu.
   <Ok>
# exit
$
    

Finished with this appendix!


C.1.2.4. Install parallel port modules

You do not have parallel port support if you see minus signs (-) on either parport or parport_pc.

Select kernel/drivers/parport modules menu
   parport       - Parallel-port support
   parport_pc    - PC-style hardware
    

Install each module by highlighting it (in blue) and choosing <Ok>. If you are asked for any command line arguments, it is safe to leave the entry box blank. Anyone who uses a printer that needs command line arguments would probably know what the arguments are.

Select kernel/drivers/parport modules menu
   parport       - Parallel-port support
   <Ok>
   parport_pc    - PC-style hardware
   <Ok>
    

When both modules are installed, exit from the menu, exit from modconf and exit from the Root user's account.

Select kernel/drivers/parport modules menu
   Exit    Finished. Return to previous menu.
   <Ok>
Select Category menu
   Exit    Finished. Return to previous menu.
   <Ok>
# exit
$
    

Finished with this appendix!


C.1.3. USB printer support

WarningThis section is untested
 

I do not have a USB printer, so this is my 'best guess' at how to install one. If you get a USB printer working please let me know () and I will update this document.


C.1.3.2. Select a module category

NoteNcurses navigation
 

Use the arrow keys and the <Tab> key to make your selections. Selected items are highlighted in blue. Use the <Enter> key to confirm your selection.

Select Category menu
kernel/drivers/usb       Universal Serial Bus (USB).
<Ok>
    

Loaded modules are tagged with a plus sign (+).


C.1.3.3. Check the status of USB port modules

You already have USB printer support if you see a plus sign (+) against USB Printer support.

Select kernel/drivers/parport modules menu
   printer    + USB Printer support
    

If there is a minus sign (-), go straight on to the next section on installing the USB printer module.

If the module is already installed, exit from the menu, exit from modconf and exit from the Root user's account.

Select kernel/drivers/parport modules menu
   Exit    Finished. Return to previous menu.
   <Ok>
Select Category menu
   Exit    Finished. Return to previous menu.
   <Ok>
# exit
$
    

Finished with this appendix!


C.1.3.4. Install the USB printer module

You do not have USB support if you see a minus signs (-) against USB Printer support.

Select kernel/drivers/usb modules menu
   printer    - USB Printer support
    

Install the module by highlighting it (in blue) and choosing <Ok>. If you do not know of any command line arguments, leave the entry box blank.

Select kernel/drivers/usb modules menu
   printer       - USB Printer support
   <Ok>
printer menu
   Install this module in the kernel?
   <Yes>
Enter Command-Line Arguments menu   _________________________________
   <Ok>
    

When you have installed the module, exit from the menu, exit from modconf and exit from the Root user's account.

Select kernel/drivers/usb modules menu
   Exit    Finished. Return to previous menu.
   <Ok>
Select Category menu
   Exit    Finished. Return to previous menu.
   <Ok>
# exit
$
    

Finished with this appendix!

Appendix: About this document


C.2. Copyright information

Copyright 2004 Chris Lale . Permission is granted to copy, distribute and/or modify this document with no Invariant Sections, with no Front-Cover texts and with no Back-Cover Texts under the terms of the GNU Free Documentation License, version 1.1 or any later version, published by the Free Software Foundation. A copy of the license can be found at http://www.fsf.org/copyleft/fdl.html.