Notes on the Common Unix Printing System and Slackware
Written by Al Grimstad
Contributing editor John Jenkins <mRgOBLIN>
Introduction
Recent versions of Slackware Linux have included an alternative
to the standard BSD style LPR-ng printing system, this system is
known as CUPS (Common UNIX Printing System).
So, What Is CUPS? (Taken from the CUPS FAQ)
CUPS provides a portable printing layer for UNIX®-based
operating systems. It has been developed by Easy Software
Products to promote a standard printing solution for all UNIX
vendors and users. CUPS provides the System V and Berkeley
command-line interfaces. CUPS is licensed under the GNU General
Public License and GNU Library General Public License.
CUPS uses the Internet Printing Protocol ("IPP") as the basis for
managing print jobs and queues. The Line Printer Daemon ("LPD"),
Server Message Block ("SMB"), and AppSocket (a.k.a. JetDirect)
protocols are also supported with reduced functionality. CUPS adds
network printer browsing and PostScript Printer Description ("PPD")
based printing options to support real-world printing under UNIX.
CUPS includes an image file RIP (raster image processor) that
supports printing of image files to non-PostScript printers. A
customized version of GNU Ghostscript 7.05 for CUPS called ESP
Ghostscript is available separately to support printing of PostScript
files within the CUPS driver framework. Sample drivers for Dymo,
EPSON, HP, and OKIDATA printers are included that use these filters.
Documentation resources for cups administrators and users are
listed at the end of this article.
Package Installation
You must choose between the cups package and the lprng and
apsfilter packages as various printing commands are symlinks and the
symlinks are based on the last installed package. Have a look at the
output of ls -l /usr/bin/lp* /usr/sbin/lp*. You also need, at least,
the espgs package, a variant of ghostscript, installed. Specific
printers are supported in the hpijs and gimp-print packages.
Required Slackware Packages
For slackware current:
a/cups-1.1.20-i486-1.tgz
ap/espgs-7.07.1-i486-2.tgz
ap/hpijs-1.5-i486-2.tgz
ap/gimp-print-4.2.6-i486-1.tgz
For slackware 9.1:
a/cups-1.1.19-i486-3.tgz
ap/espgs-7.05.6-i486-2.tgz
ap/hpijs-1.4.1-i486-2.tgz
ap/gimp-print-4.2.5-i386-1.tgz
Once the cups packages are installed, the cups daemon needs to be
running for the cups system to function. Make sure that
/etc/rc.d/rc.cups is executable and cups will be started the next time
you boot your system. To start cups immediately after installation,
run:
# /etc/rc.d/rc.cups start
Installing a Printer via CUPS
There are two minimum pieces of information you must tell the
cups system when you install a printer, how to connect to the
printer, e.g., via parallel, usb or network spooling interface,
and which postscript printer description (PPD) file to use for
processing print jobs. Note that, if you want cups to spool only
and in no way process print jobs, you can configure a “raw” queue
and will not need a PPD file. Normally, you probably don’t want
to do this.
To see which “backend” interfaces your system supports, look at
the output of
$ /usr/sbin/lpinfo -v
The backends are of two kinds, local connections, e.g.,
direct canon:/dev/lp0
direct epson:/dev/lp0
direct parallel:/dev/lp0
...
direct usb:/dev/usb/lp0
direct usb:/dev/usb/lp1
...
and network connections, e.g.,
network socket
network http
network ipp
network lpd
network smb
If you are using a standard slackware 2.4 kernel, parallel port
printing support is built as a kernel module. If your output of
lpinfo does not contain the /dev/lp0 interfaces, you’ll need to
load the lp module:
/sbin/modprobe lp
and restart cupsd. If you plan to print to the parallel port, you
will want to uncomment a line like this in /etc/rc.d/rc.modules,
so that the parallel port will be available for printing after
each system boot.
There are no standard slackware 2.6 kernels as of this
writing. If you build your own, based on a slackware config file
(make oldconfig), you may see a slightly different behavior. In
my experience, the following is required to enable parallel port
printing:
/sbin/modprobe parport_pc
Whichever kernel version you are using, 2.4 or 2.6, parallel
printing with a slackware style kernel requires that two modules be
loaded, lp and parport_pc.
Make a note of the backend interface that applies to your printer.
To identify a PPD file for your printer, start at
http://linuxprinting.org/printer_list.cgi
If you have an HP, Epson or Canon printer, it might already be
supported by cups and its support packages. To see which drivers are
pre-installed, inspect the output of:
$ /usr/sbin/lpinfo -m
If your printer is not already supported, download a PPD file
from linuxprinting.org. One place to put the ppd file which will
be especially useful is in /usr/share/cups/model.
To install the print queue “my-printer” with the PPD file
“my-ppd” for a printer attached to your parallel port, the command
is:
# /usr/sbin/lpadmin -p my-printer -m my-ppd -v parallel:/dev/lp0 -E
Optionally, you can add -L location and -D description arguments
to the command.
If the printer is attached via USB, the command would be:
# /usr/sbin/lpadmin -p my-printer -m my-ppd -v usb:/dev/usb/lp0 -E
And if the printer is attached to an HP JetDirect network spooler, the
command would be:
# /usr/sbin/lpadmin -p my-printer -m my-ppd -v socket://hostname:9100 -E
Other print server manufacturers use different ports, e.g., Linksys and
Netgear use port 4010.
If you make a mistake and want to remove a print queue,
# /usr/sbin/lpadmin -p my-printer -x
If you put your downloaded PPD files in a non standard place, use the
-P option followed by a path to the PPD file in place of the -m option.
Testing and Using
To list the available printers on a system using cups,
$ /usr/bin/lpstat -v
After installing a new printer, it should appear in the listing of the
above command. To verify that it is accepting jobs, inspect the output
of:
# /usr/sbin/lpc status [my-printer]
or
# /usr/bin/lpstat -a my-printer
To print a test file to see the quality of your output,
$ /usr/bin/lpr -p my-printer /usr/share/cups/data/testprint.ps
For a treatment of the various options to lpr for controlling printing
output, see http://www.cups.org/sum.html.
Cups also supports the lp command for printing and the familiar print
job management commands such as lpq, lprm and cancel.
To make my-printer your system default printer,
# /usr/sbin/lpadmin -d my-printer
A user can set a default printer via,
$ /usr/bin/lpoptions -d my-other-printer
GUI Administration
To add and manage cups printers via a GUI, point your browser at
http://localhost:631/. The default configuration of cups limits access
to this GUI to users on the local host. This can be changed, as will
be described in the section below on CUPS Daemon Configuration.
CUPS Daemon Configuration
As mentioned above, the cups daemon is started from
/etc/rc.d/rc.cups. The default configuration of the daemon will in
many cases be adequate. Extensions from the default behavior are made
by modifications of the daemon’s configuration file,
/etc/cups/cupsd.conf. Access control and browsing support are two such
extensions that many will find useful.
By default, cupsd only permits local processes to submit print
jobs. This restriction can be relaxed, for example to permit hosts on
the local subnet access to printing on the host. To do this look for
the part of the file beginning:
######## Security Options
and scroll down to
<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
</Location>
Suppose your subnet is 192.168.1/24; then modify the above to read
<Location />
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
Allow From 192.168.1/24
</Location>
and restart cupsd. Now hosts in the 192.168.1/24 subnet will be able
to use the printer queues managed by this cupsd.
To enable remote GUI administration of printers on the system, make
modifications to the section beginning:
<Location /admin>
This is discussed further in the Printing System Security section of
http://www.cups.org/sam.html.
Browsing is the term cups uses for its support for automatic
distribution of printing information from hosts with cups print
queues. In cupsd.conf, look for the section of the file beginning
######## Browsing Options
Suppose the subnet address of the server is 192.168.1/24. Then add a
line to the configuration file like this:
BrowseAddress 192.168.1.255
and restart the cups daemon. Now on other hosts on the same subnet
running cupsd, printers from this host will become visible. On another
host a user can run lpstat and see the printer you have added, e.g.,
$ lpstat -v
device for my-printer: ipp://host.domain:631/printers/my-printer
...
This printer is immediately usable, here under the name
“my-printer”. The local and remote cups daemons will communicate to
allow this to happen.
This capability can be extended to other subnets. Suppose ServerX is
running a cups daemon on subnet 192.168.2/24. To enable local hosts on
the 192.168.1/24 subnet to see the remote printers on the 192.168.2/24
subnet, add the following lines to the main cups server on the
192.168.1/24 subnet and restart cupsd:
BrowsePoll ServerX
BrowseRelay 127.0.0.1 192.168.1.255
Samba
Printing support for samba is a large topic. To learn more about
this, refer to the samba documentation referenced below. There
are just two points that it will probably be useful to mention
here.
First, one way to support windows users is to install all print
drivers on the users’ computers themselves. In this case, cups
will only perform a queuing function for the printers it manages
and the queues themselves can omit configuration with a PPD. By
default, cups does not permit arbitrary (e.g., binary) files to
be sent to printers. To enable fully “raw” queuing, look at the
two files mime.convs and mime.types in /etc/cups. In the last few
lines of each file is a commented out reference to a mime type
application/octet-stream. Uncomment out these two lines and
restart the cups daemon to enable totally raw queuing.
Second, anyone who has supported printers in a networked windows
environment knows that the drivers supplied by vendors are
occasionally less than perfect. The folks at the cups project
have a very nice solution to this problem. They have written a
generic open source windows postscript printer driver that can be
used in the cups/samba context and which can be automatically
installed on windows clients by browsing the appropriate samba
server’s share. This driver is associated with a print queue via
the cupsaddsmb program, which is contained in the slackware cups
package. The only limitations of this program is that it supports
windows NT, 2K and XP hosts but not windows 95 and 98. I have
also noticed that, at its current state of development, not all
PPD files work correctly with cupsaddsmb.
Documentation resources
The best place to start learning about CUPS is the top documentation
page at the CUPS web site. You
will especially want to consult:
Also very useful are:
Copyright notes
CUPS, the Common UNIX Printing System, the CUPS logo, and ESP
Print Pro are the trademark property of Easy Software Products.