Network Printing

Network Printing

by Matthew S. Gast, Todd Radermacher
     
 

This guide shows how to set up a network printing architecture that supports all kinds of clients using Linux machines as print servers. It covers the standard Unix print servers on BSD and System V, LPRng, Samba printing services, and using LDAP as a configuration repository for printers.See more details below

Overview

This guide shows how to set up a network printing architecture that supports all kinds of clients using Linux machines as print servers. It covers the standard Unix print servers on BSD and System V, LPRng, Samba printing services, and using LDAP as a configuration repository for printers.

Product Details

ISBN-13:
9780596000387
Publisher:
O'Reilly Media, Incorporated
Publication date:
10/28/2000
Series:
Network Administration Series
Pages:
304
Product dimensions:
7.03(w) x 9.18(h) x 0.77(d)

Read an Excerpt

Chapter 5: The Next Generation Berkeley Spooler: LPRng

In this chapter:
Compiling and Installing LPRng
Configuring LPRng
More Fun with Filters
Accounting

In spite of our great fondness for the Berkeley spooler, we must admit that its age clearly shows--the stock Berkeley spooler has been in use longer than many of its users have been working with computers. Recent developments have led to one potential successor: LPRng. LPRng began life as a PLP, a reimplementation of the Berkeley spooler free of the AT&T Unix license. In the early 1990s at San Diego State University in California, Patrick Powell redesigned and rewrote the PLP code base to build a print server package that could stand up to the rigors of an academic environment.1 Due to the number of changes that were made, the package was renamed LPRng in honor of its venerable ancestor.

LPRng supports the LPD protocol as described in RFC 1179, but adds several nifty features. System V command emulation enables system administrators to replace System V spoolers with Berkeley spoolers while retaining compatibility with System V print commands. Several configuration file options make it easier to manage large sites or improve scalability.

Perhaps the main strength of LPRng, though, is that it can be used to provide a unified interface to the print spooler on several different operating systems. For administrators who are more familiar with the Berkeley spooler, it offers the opportunity to replace System V spoolers with Berkeley spoolers, but such an ambitious project should not be taken lightly.

Compiling and Installing LPRng

The first step in using any software package distributed in source form is compilation and installation. Several modern Linux distributions have, however, adopted LPRng as the standard print spooler. Compiling Your Own Binaries

On other operating systems, especially those descended from System V, building from source is required. LPRng is freely available in source form under the GNU General Public License from ftp://ftp.astart.com/pub/LPRng. The latest stable distribution will be stored as LPRng-stable.tgz. Documentation is distributed from the same site in the file LPRng_DOC-latest.tgz. As this chapter was written, the latest version of LPRng was 3.6.12.2 Unpacking the source

The source is distributed as a compressed tar file. Uncompress and unpack it with tar and gzip, as shown here:

bastet:~/lprng$ gunzip LPRng-stable.tgz bastet:~/lprng$ tar -xf LPRng-stable.tar LPRng-3.6.12/ LPRng-3.6.12/src/ . . .etc. . . 
Configuring for your system

One of our favorite trends in free software for Unix systems is the use of the GNU autoconfiguration package. Software developers include a script that runs many small test programs to determine what library calls are available and where other software is installed. GNU autoconf reduces configuration to running the . /configure script in the top-level source directory. You will see a large number of tests. Here is the start of the procedure on a Sun running Solaris 7:

bastet:~/lprng$ cd LPRng-3.6.12 bastet:~/lprng/LPRng-3.6.12$ ./configure creating cache ./config.cache checking host system type... sparc-sun-solaris2.7 checking target system type... sparc-sun-solaris2.7 checking build system type... sparc-sun-solaris2.7 checking for mawk... no checking for gawk... no checking for nawk... nawk checking for perl... /usr/bin/perl . . . other tests skipped . . . 

By default, LPRng will be installed in /usr/local, but the target can be set by supplying the -bindir option to the configure script, or by editing the Makefile after running the configure script. Compiling the code

The next step is to run make to build the software. Minor confusion exists because GNU make and Berkeley make are slightly different.

With GNU make, run make clean all. For BSD make, specify the BSD Makefile instead by using the -f option on the command line: make -f Makefile.bsd clean all. Here is the beginning of the procedure for Solaris 7:53

bastet:~/lprng/LPRng-3.6.12$ gmake clean all gmake MAKETARGET=clean src man po gmake[1]: Entering directory `/export/home/gast/LPRng-3.6.12' gmake -C src clean gmake[2]: Entering directory `/export/home/gast/LPRng-3.6.12/src' rm -f *.o *.core *.a ? core lpc lpd lpq lpr lprm lpf lpraccnt pclbanner psbanner checkpc lp lpstat lpbanner monitor ../lpd.conf
sserver sclient
gmake[2]: Leaving directory `/export/home/gast/LPRng-3.6.12/src' gmake -C man clean gmake[2]: Entering directory `/export/home/gast/LPRng-3.6.12/man' gmake[2]: Nothing to be done for `clean'. gmake[2]: Leaving directory `/export/home/gast/LPRng-3.6.12/man' gmake -C po clean gmake[2]: Entering directory `/export/home/gast/LPRng-3.6.12/po' gmake[2]: Nothing to be done for `clean'. gmake[2]: Leaving directory `/export/home/gast/LPRng-3.6.12/po' gmake[1]: Leaving directory `/export/home/gast/LPRng-3.6.12' gmake -C src all gmake[1]: Entering directory `/export/home/gast/LPRng-3.6.12/src' gcc -g -O2 -g -Wall -DHAVE_CONFIG_H -DLOCALEDIR=\"/usr/local/share/locale\" -DLPD_CONF_PATH=\"/usr/local/
etc/lpd.conf\" -DLPD_PERMS_PATH=\"/usr/local/etc/lpd.perms\" -DPRINTCAP_PATH=\"/usr/local/etc/printcap\" -DLPD_
PRINTCAP_PATH=\"/usr/local/etc/lpd_printcap\" -DFORCE_LOCALHOST=\"1\" -DREQUIRE_CONFIGFILES=\"1\" -I..
-I./include -c -o lpc.o ./common/lpc.c
. . . lots of other stuff skipped. . .
Installation

As root, run make again to install the binaries to the location specified in the Makefile. If your system uses a BSD derived version of make, use Makefile.bsd :

bastet:~/lprng/LPRng-3.6.12$ su - Password: Sun Microsystems Inc.   SunOS 5.7       Generic October 1998 # gmake install gmake MAKETARGET=install src man po gmake[1]: Entering directory `/export/home/gast/LPRng-3.6.12' gmake -C src install gmake[2]: Entering directory `/export/home/gast/LPRng-3.6.12/src' echo "SETUID_ROOT IS SUID_ROOT_PERMS, PERMS 04755 -o root"; SETUID_ROOT IS SUID_ROOT_PERMS, PERMS 04755 -o root for i in /usr/local/bin /usr/local/sbin /usr/local/sbin /usr/local/libexec/filters; do \   if [ ! -d $i ] ; then ./mkinstalldirs $i ; fi; \ done; mkdir /usr/local/sbin mkdir /usr/local/libexec/filters .././install-sh -c -s -m 04755 -o root lpq /usr/local/bin .././install-sh -c -s -m 04755 -o root lprm /usr/local/bin .././install-sh -c -s -m 04755 -o root lpr /usr/local/bin .././install-sh -c -s -m 04755 -o root lpstat /usr/local/bin .././install-sh -c -s -m 04755 -o root lpc /usr/local/sbin . . . more skipped  . . . 

Installation ends with the installation of skeleton lpd.perms and lpd.conf files in /usr/local/etc. Replacing the Existing Spooler

When replacing an existing spooler, begin by removing your old spooler software. Kill the old daemon

The spooler daemon on BSD systems is lpd:

# kill `ps -aux | grep lpd | grep -v grep | awk '{print $2}'` 

System V uses the lpsched daemon, and requires slightly different flags to ps:

# kill `ps -ef | grep lpsched | grep -v grep | awk '{print $2}'` 
CLASS="HeadC">Replace the vendor-provided printing programs with the LPRng programs

First, check your system's man pages to find the name of the programs that make up your print system. To search the disk for the lpr program, use the find command:

# find / -type file -name lpr -print 

After running the find command, rename the existing program lpr, and then link lpr to the LPRng lpr :

# mv /usr/bin/lpr /usr/bin/lpr.orig # ln -s /usr/local/bin/lpr /usr/bin/lpr 
Modify system startup scripts

System startup scripts launch the print spooler daemon on boot. On BSD systems, look for the command that starts lpd in /etc/rc and replace it with a line that runs the LPRng lpd instead. Alternatively, remove that line entirely and run the LPRng lpd in /etc/rc.local.

On System V, print services are frequently started at run level 3. Look for the script that starts lpsched and delete it (or at least rename it). You also need to track down and delete the S and K links to this script, which are probably in /etc/init.d/rc3.d. We'll replace this with a script that starts the LPRng lpd. The very basic script in Example 5-1 provides a jumping off point for further customization. For example, some administrators first check that the System V daemons are stopped before starting LPRng daemons....

Read More

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >