source: trunk/third/lprng/doc/LPRng-HOWTO-4.html @ 13098

Revision 13098, 28.9 KB checked in by danw, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r13097, which included commits to RCS files with non-trunk default branches.
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2<HTML>
3<HEAD>
4 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
5 <TITLE> LPRng-HOWTO: Installing the Software</TITLE>
6 <LINK HREF="LPRng-HOWTO-5.html" REL=next>
7 <LINK HREF="LPRng-HOWTO-3.html" REL=previous>
8 <LINK HREF="LPRng-HOWTO.html#toc4" REL=contents>
9</HEAD>
10<BODY>
11<A HREF="LPRng-HOWTO-5.html">Next</A>
12<A HREF="LPRng-HOWTO-3.html">Previous</A>
13<A HREF="LPRng-HOWTO.html#toc4">Contents</A>
14<HR>
15<H2><A NAME="installation"></A> <A NAME="installingprograms"></A> <A NAME="s4">4. Installing the Software</A></H2>
16
17<P>The basic components of the LPRng system are the executables
18and the database files.
19This section deals with generating and installing the executable
20files.
21<H2><A NAME="ss4.1">4.1 Files and Setup</A>
22</H2>
23
24<P>The LPRng package consists of:
25<UL>
26<LI> <EM><CODE>lpd</CODE></EM> - the LPD print server program</LI>
27<LI><EM><CODE>lpr</CODE></EM>,
28<EM><CODE>lpq</CODE></EM>,
29<EM><CODE>lprm</CODE></EM>,
30and
31<EM><CODE>lpc</CODE></EM> -
32client programs for printing,
33status queries, job removal, and server configuration respectively.</LI>
34<LI><EM><CODE>/etc/printcap</CODE></EM> print queue database file.</LI>
35<LI><EM><CODE>/etc/lpd.conf</CODE></EM> program configuration options.</LI>
36<LI><EM><CODE>/etc/lpd.perms</CODE></EM> permission information.</LI>
37</UL>
38<P>By default, the LPRng client programs are installed in
39<CODE>/usr/local/bin</CODE>
40and the <CODE>lpd</CODE> server in
41<CODE>/usr/local/sbin</CODE>.
42By tradition,
43UNIX systems have installed printer utilities in
44in widely varied locations such as
45<CODE>/usr/lib</CODE>,
46<CODE>/usr/bin</CODE>,
47<CODE>/usr/libexec</CODE>,
48<CODE>/usr/ucb</CODE>,
49<CODE>/opt</CODE>,
50<CODE>/usr/sbin</CODE>,
51and
52<CODE>/usr/etc/</CODE>.
53During installation the old print system files should either be renamed or removed.
54<P>The
55<CODE>
56<A HREF="LPRng-HOWTO-8.html#printcapref">/etc/printcap</A></CODE>
57file contains the printer database information.
58Information in this file can override the
59<CODE>/etc/lpd.conf</CODE>
60and default configuration information.
61The
62<CODE>
63<A HREF="LPRng-HOWTO-11.html#lpdconf">/etc/lpd.conf</A></CODE>
64file contains configuration
65information for the server and client programs.
66The compiled in defaults should be suitable for most small user installations.
67The
68<CODE>
69<A HREF="LPRng-HOWTO-14.html#lpdpermsref">/etc/lpd.perms</A></CODE>
70file contains the permission database information.
71<P>
72<H2><A NAME="ss4.2">4.2 Source Code and Support Programs</A>
73</H2>
74
75<P>
76<OL>
77<LI>Obtain the latest version of the LPRng source code from a
78<A HREF="LPRng-HOWTO-1.html#secftp">LPRng FTP Site</A>.</LI>
79<LI>Obtain the GNU Zip (compression) program from one of the many
80<A HREF="http://prep.ai.mit.edu">GNU Software Mirror Sites</A>
81and install it.
82See the directions in the GNU Zip distribution for details.</LI>
83<LI>Obtain the GNU Make program from one of the many
84<A HREF="http://prep.ai.mit.edu">GNU Software Mirror Sites</A>.
85and install it.
86See the directions in the GNU Zip distribution for details.
87This program will be referred to as
88<CODE>gmake</CODE> in the installation instructions.</LI>
89<LI>Obtain an ANSI C compiler.
90The GCC compiler (from the
91<A HREF="http://prep.ai.mit.edu">GNU Software Mirror Sites</A>)
92is strongly recommended.</LI>
93<LI>Solaris Sparc and X86 Binaries for GCC and Make  can be obtained from
94<A HREF="http://smc.vnet.net/">http://smc.vnet.net/</A>.</LI>
95</OL>
96<H2><A NAME="ss4.3">4.3 Configuration and Installation</A>
97</H2>
98
99<P>In the following discussion,
100the LPRng distribution will have the name
101<CODE>LPRng-&lt;version&gt;.tgz</CODE>.
102<P>Unpack,  configure,
103compile, and install,
104and initialize the distribution using:
105<BLOCKQUOTE><CODE>
106<PRE>
107gunzip -c LPRng-&lt;version>.tgz | tar xvf -
108cd LPRng-&lt;version>
109# see discussion below for configuration options
110./configure
111gmake clean all
112su   # you must do the following commands as root
113gmake install
114# if  you have not installed LPRng before,
115# install default lpd.perms and lpd.conf file in /etc
116if [ ! -f /etc/lpd.perms ]; then
117    make default;
118fi;
119# update permissions,  create files needed for LPRng, check
120# /etc/printcap file for problems.  Do as root:
121./src/checkpc -f
122</PRE>
123</CODE></BLOCKQUOTE>
124<P>
125<H2><A NAME="ss4.4">4.4 Configuration Options and Problems with Compilation</A>
126</H2>
127
128<P>The <CODE>configure</CODE>
129script will determine the type of system and establish a set of defaults
130for compilation and installation.
131The <CODE>LPRng/INSTALL</CODE>
132file contains detailed descriptions of the various configuration options and
133capabilities.
134<P>If you have problems compiling the package, you can try these things:
135<OL>
136<LI>Compiler complains about missing files or has a large number of
137errors.<BR>
138Try <CODE>gcc</CODE> instead of your vendor's C compiler.
139This can be done either by setting
140the
141<CODE>CC</CODE> environment variable or using the
142<CODE>--with-cc</CODE> configure option.
143<BLOCKQUOTE><CODE>
144<PRE>
145CC=gcc ./configure
146   OR
147configure --with-cc=gcc
148</PRE>
149</CODE></BLOCKQUOTE>
150
151</LI>
152<LI>Missing libraries or include files.<BR>
153Usually this is caused when include files are in
154<CODE>/usr/local/include</CODE>
155and libraries are in
156<CODE>/usr/local/include</CODE>
157and these paths are not searched or used by the compiler.
158This can be fixed by setting the
159<CODE>CPPFLAGS</CODE> and <CODE>LDFLAGS</CODE> environment variables,
160or using the
161<CODE>--with-cppopts=</CODE>
162and
163<CODE>--with-ldopts=</CODE>
164configure options.
165<BLOCKQUOTE><CODE>
166<PRE>
167CPPFLAGS="-I/usr/local/include -I/usr/include/kerberosIV" \
168  LDFLAGS="-L/usr/local/lib -L/usr/lib/kerberosIV" \
169  ./configure
170   OR
171configure --with-cppopts="-I/usr/local/include -I/usr/include/kerberosIV" \
172  --with-ldopts="-L/usr/local/lib -L/usr/lib/kerberosIV"
173</PRE>
174</CODE></BLOCKQUOTE>
175</LI>
176<LI>The default installation locations are not the desired ones.<BR>
177See the detailed discussions in the INSTALL file,
178especially the section dealing with the
179<CODE>--with-lpddir</CODE>,
180<CODE>--exec-prefix=</CODE>,
181<CODE>--bindir=</CODE>,
182<CODE>--sbindir=</CODE>,
183and other basic
184<CODE>configure</CODE>
185options.</LI>
186</OL>
187<P>The <CODE>configure</CODE> and <CODE>make</CODE> steps must be run on
188the target host,
189especially if the target host has a different version of the operating system.
190This is extremely important for SunOS or Solaris,
191where
192there tend to be changes in the system's include files between
193versions
194as well as support libraries.
195<P>Also read the notes for your OS in section
196<A HREF="LPRng-HOWTO-5.html#sysdep">System-dependent notes</A>
197for specific installation help (if any).
198<H2><A NAME="disablelocalhost"></A> <A NAME="ss4.5">4.5 Advanced Configuration Options</A>
199</H2>
200
201<P>While the default LPRng configuration will be suitable for most
202individual users,
203administrators of large sites or which need to support
204<I>lightweight print clients</I>
205will need to use the following configure options.
206<OL>
207<LI><CODE>--disable-force_localhost</CODE><BR>
208The default LPRng configuration assumes that all printing will be done
209via a <CODE>lpd</CODE> print spooler running on the local host system.
210However,
211many larger sites prefer that all users do their printing via a
212few central servers,
213and do not run
214<CODE>lpd</CODE> servers on user systems.
215The
216<CODE>--disable-force_localhost</CODE>
217configuration will simply this type of operation by eliminating the need for
218a
219<CODE>/etc/lpd.conf</CODE> file to override the <CODE>force_localhost</CODE> option.
220Example:
221<BLOCKQUOTE><CODE>
222<PRE>
223./configure --disable-force_localhost
224</PRE>
225</CODE></BLOCKQUOTE>
226</LI>
227<LI><CODE>--disable-lpd_bounce</CODE>
228The default LPRng configuration assumes that each
229<CODE>lpd</CODE> server will process and modify print jobs as they are forwarded
230from server to server.
231While this is usually the desired operation on small sites or on individual systems,
232this is usually not the desired operation on sites running central servers,
233as will requires distributing filter software to all the user workstations.
234Example:
235<BLOCKQUOTE><CODE>
236<PRE>
237./configure --disable-lpd_bounce
238</PRE>
239</CODE></BLOCKQUOTE>
240</LI>
241</OL>
242<P>
243<H2><A NAME="ss4.6">4.6 Printcap and lpd.conf files</A>
244</H2>
245
246<P>The <CODE>/etc/printcap</CODE> file contains the definitions of print queues
247and other information used by LPRng.
248If your system does not have an <CODE>/etc/printcap</CODE> file,
249then the following is suitable for initial testing and configuration:
250<BLOCKQUOTE><CODE>
251<PRE>
252# test printcap file
253lp:cm=Test Printcap Entry:
254 :lp=/dev/null
255 :sd=/usr/spool/lpd/lp
256</PRE>
257</CODE></BLOCKQUOTE>
258<P>The <CODE>/etc/ifhp.conf</CODE>
259file contains settings that override the defaults provided at compile time.
260You will find a prototype or template <CODE>ifhp.conf</CODE> file in the LPRng distribution.
261You can install this by using:
262<BLOCKQUOTE><CODE>
263<PRE>
264astart > cd LPRng
265astart > su
266ASTART # make init
267           or
268ASTART # cp /etc/ifhp.conf /etc
269ASTART # chmod 644 /etc/ifhp.conf
270</PRE>
271</CODE></BLOCKQUOTE>
272<H2><A NAME="user"></A> <A NAME="group"></A> <A NAME="ss4.7">4.7 Security, Permissions, and CHECKPC</A>
273</H2>
274
275<P>By default,
276the <CODE>lpd</CODE> server is run as a ROOT (user 0)
277process.
278(This is true not only for LPRng,  but also for all
279other system processes which are started at boot time.)
280However,
281normally LPRng will do operations as a non-privileged user and group
282which is defined by the value of the
283<CODE>user</CODE> (default <CODE>daemon</CODE>) and
284<CODE>group</CODE> (default <CODE>daemon</CODE>) option
285in the <CODE>/etc/lpd.conf</CODE> configuration file
286or the compile time defaults in the
287<CODE>LPRng/src/vars.c</CODE> file.
288<P>The following steps must be taken in order to preserve
289system security:
290<OL>
291<LI>Create a user and group <CODE>daemon</CODE> on the system.
292This user does not need login privileges,
293but will need a home directory if secure authentication
294such as Kerberos or PGP will be done.</LI>
295<LI>The <CODE>/etc/lpd.conf</CODE>
296file should be owned by root (user 0),
297and should have read-only (0444) permissions.</LI>
298<LI>The <CODE>/etc/printcap</CODE>
299file should be owned by root (user 0),
300and should have read-only (0444) permissions.</LI>
301<LI>The spool and working directories used by LPRng should be
302owned by user <CODE>daemon</CODE>,  group <CODE>daemon</CODE>,
303and have 0700 permissions (accessible only by user <CODE>daemon</CODE>).</LI>
304</OL>
305<H3>Using CHECKPC</H3>
306
307<P>The
308<CODE>checkpc</CODE>
309program is used to make sure that
310the spool directories and files used by LPRng have the correct permissions
311and are in place.
312By default,
313<CODE>checkpc</CODE> will check permissions and report if there are any problems.
314You should run this as <CODE>root</CODE>.
315For example:
316<BLOCKQUOTE><CODE>
317<PRE>
318% astart > su
319#>cd LPRng/src
320#>./checkpc
321Warning - No configuration file found in '/etc/lpd.conf:/usr/etc/lpd.conf'
322Warning - No lpd only printcap file found in '/etc/lpd_printcap,/usr/etc/lpd_printcap'
323Warning -  ** cannot open '/var/run/lpd.printer' - 'Permission denied'
324Warning -  bad directory - /var/spool/lpd/lp
325Warning -   Printer_DYN 'lp' spool dir '/var/spool/lpd/lp' needs fixing
326</PRE>
327</CODE></BLOCKQUOTE>
328<P>In the above example,
329<CODE>checkpc</CODE> has discovered that the <CODE>/etc/lpd.conf</CODE>
330file is missing.
331This is not a serious problem if the system defaults are to be used,
332but you might want to put the default <CODE>LPRng/lpd.conf</CODE> file from the
333distribution in place.
334<P>The <I>lpd only printcap</I>
335message is usually of concern to administrators who wish to use some of
336LPRng's more exotic configuration options.
337It is possible to have separarte printcap databases for client and server programs.
338This is useful when printcap files get extremely large and cuts down
339substantially on system management problems.
340<P>The permission denied message for <CODE>/var/run/lpd.printer</CODE> is more serious,
341as the <CODE>lpd</CODE> server uses this as a lock file.
342<P>The <I>bad directory</I> message about the spool directory is usually caused by
343bad permissions or when the directory is missing.
344<P>The <CODE>checkpc -f</CODE> option causes <CODE>checkpc</CODE> to take action to rectify errors.
345You can see what is happening if you run it with the <CODE>-V</CODE> (vervose) option:
346<BLOCKQUOTE><CODE>
347<PRE>
348% astart > su
349#>cd LPRng/src
350# ./checkpc -f -V
351LPRng version LPRng-3.6.1
352 DaemonUID 1, DaemonGID 12
353Using Config file '/etc/lpd.conf:/usr/etc/lpd.conf'
354Checking for configuration files '/etc/lpd.conf:/usr/etc/lpd.conf'
355Warning - No configuration file found in '/etc/lpd.conf:/usr/etc/lpd.conf'
356Checking for printcap files '/etc/printcap,/usr/etc/printcap'
357  found '/etc/printcap', mod 0100644
358Checking for lpd only printcap files
359     '/etc/lpd_printcap,/usr/etc/lpd_printcap'
360Warning - No lpd only printcap file found in
361     '/etc/lpd_printcap,/usr/etc/lpd_printcap'
362LPD lockfile '/var/run/lpd.printer'
363  checking '/var/run/lpd.printer' file
364Names
365 :lp=lp
366All
367 :lp
368Printcap Information
369lp
370 :force_localhost
371 :lp=lw4@astart4.astart.com
372 :sd=/var/spool/lpd/lp
373Checking printcap info
374Checking printer 'lp'
375 Checking directory: '/var/spool/lpd/lp'
376  file 'control.lp', size 0 K, unchanged in 2 hours
377  file 'status.lp', size 0 K, unchanged in 2 hours
378  file 'status', size 0 K, unchanged in 2 hours
379  file 'log', size 0 K, unchanged in 2 hours
380  checking 'control.lp' file
381  checking 'status.lp' file
382  checking 'status' file
383  cleaning 'status' file, 0 bytes long: no truncation
384  checking 'log' file
385  cleaning 'log' file, 0 bytes long: no truncation
386
387# ./checkpc
388Warning - No configuration file found in '/etc/lpd.conf:/usr/etc/lpd.conf'
389Warning - No lpd only printcap file found in '/etc/lpd_printcap,/usr/etc/lpd_printcap'
390</PRE>
391</CODE></BLOCKQUOTE>
392<P>As you can see, <CODE>checkpc</CODE> can not only print detailed information about your
393printing system,  but it also fixes up the various problems.
394<H3>Advanced Security Concerns</H3>
395
396<P>While <CODE>checkpc</CODE> will set permissions,
397there is always the problem with undetected errors in the LPRng
398software that,
399when exploited,
400could cause severe system problems.
401The most serious concern is that of gaining root (user 0) permissions.
402<P>One way to avoid this is to run
403<I>client</I>
404programs without root permission.
405This is the default operation for LPRng,
406in contrast to other print spooling software.
407<P>A remaining problem is the fact that on most UNIX
408platforms,
409<CODE>lpd</CODE> requires root permissions to open port 515.
410One option is to have the <CODE>lpd</CODE> server drop root permissions
411soon after binding to this port and before accepting any user
412commands.
413However,
414in order to be compatible with RFC1179,
415<CODE>lpd</CODE> must originate connections from a <I>reserved</I>
416port in the range 721-731,
417although in practice port 1-1023 seems to be acceptible.
418<P>If interoperability with existing print spoolers is not desired,
419then it is <I>trivial</I>
420to configure LPRng using the <CODE>lpd.conf</CODE>
421file or by modifying the compile time
422<CODE>lpd_port</CODE>
423value in the file or the <CODE>LPRng/src/vars.c</CODE>
424so that all the software will run
425as client programs.
426For example,
427in the <CODE>/etc/lpd.conf</CODE> file,
428you only need to change the indicated lines:
429<BLOCKQUOTE><CODE>
430<PRE>
431# Purpose: lpd port
432#   default lpd_port=printer
433lpd_port=2000
434</PRE>
435</CODE></BLOCKQUOTE>
436<P>Now all the LPRng software will use port 2000 to transfer jobs and
437commands.
438You can also use this facility to establish a
439<I>private</I> set of print spoolers which can be used for testing.
440<H2><A NAME="ss4.8">4.8 Stopping Existing Spooler Software</A>
441</H2>
442
443<P>The next step is to shut down and remove the existing print
444spooler,
445and test the functionality of the LPRng <CODE>lpd</CODE>
446programs.
447Unfortunately,
448this process is fairly system dependent,
449and requires a small amount of system expertise.
450In addition to these general directions,
451you should see the
452<A HREF="LPRng-HOWTO-5.html#sysdep">System specific notes</A> for your system.
453<H3>SunOS and BSD Derived</H3>
454
455<P>This section provides instructions for  systems that use the
456<CODE>lpd</CODE> print services,
457such as SunOS,
458BSD derived systems,
459and Linux based systems.
460These systems use an <CODE>lpd</CODE> print server,
461as does LPRng.
462<P>We first kill the currently running <CODE>lpd</CODE> process.
463While there may be a system shutdown script
464in the <CODE>/etc/rc.d/</CODE> directory or other location for this,
465do not bother using it.
466<BLOCKQUOTE><CODE>
467<PRE>
468# most BSD Systems
469ps -auxw |grep lpd
470# Kill it twice
471kill (pid of lpd server)
472#  This should report an error - if not then lpd did not terminate
473kill (pid of lpd server)
474#
475
476Example:
477astart % ps -axuw |grep lpd
478papowell 23932  0.0  0.3  224  184  p3  S+  10:40AM  0:00.01 grep lpd
479daemon  17763  0.0  0.2  448  120  ??  IWs  29Mar99  0:01.35 (lpd)
480astart % kill 135
481astart % kill 135
482135: No such process
483</PRE>
484</CODE></BLOCKQUOTE>
485<P>Next,
486you should remove or rename the existing print system executables.
487The following example shows how to use the
488<CODE>find</CODE> utility to track down candidates.
489<BLOCKQUOTE><CODE>
490<PRE>
491astart# find /usr -type f -name lp\*  -print >/tmp/candidates
492astart# find /sbin -type f -name lp\*  -print >>/tmp/candidates
493astart# cat /tmp/candidates
494/usr/bin/lpunlock
495/usr/bin/lpqall.faces
496/usr/bin/lpq             &lt;---- old
497/usr/bin/lpr             &lt;---- old
498/usr/bin/lprm            &lt;---- old
499/usr/bin/lptest
500/usr/doc/samba-1.9.18p10/examples/printer-accounting/lp-acct
501/usr/man/man1/lpq.1
502/usr/man/man1/lpr.1
503/usr/man/man1/lprm.1
504/usr/man/man1/lptest.1
505/usr/man/man4/lp.4
506/usr/man/man8/lpc.8
507/usr/man/man8/lpd.8
508/usr/sbin/lpc            &lt;--- old
509/usr/sbin/lpd            &lt;--- old
510/usr/sbin/lpf            &lt;--- old
511/usr/local/bin/lpc    &lt;-- LPRng
512/usr/local/bin/lpq    &lt;-- LPRng
513/usr/local/bin/lpr    &lt;-- LPRng
514/usr/local/bin/lprm   &lt;-- LPRng
515/usr/local/sbin/lpd   &lt;-- LPRng
516astart # mv /usr/bin/lpq  /usr/bin/lpq.old
517astart # mv /usr/bin/lpr  /usr/bin/lpr.old
518astart # mv /usr/bin/lprm /usr/bin/lprm.old
519astart # mv /usr/sbin/lpc /usr/sbin/lpc.old
520astart # mv /usr/sbin/lpd /usr/sbin/lpd.old
521astart # mv /usr/sbin/lpf /usr/sbin/lpf.old
522...
523</PRE>
524</CODE></BLOCKQUOTE>
525<H3>Solaris, HP, AIX, and SysVR4 Derived Systems</H3>
526
527<P>The original SysVR4 and other related systems did not have
528any support for RFC1179 network printing (Berkeley LPD).
529Support for this was added by various manufacture specific methods.
530Unfortunately,
531there are a wide range of possibilities.
532<P>The <CODE>lpsched</CODE> process (<CODE>/usr/lib/lp/lpsched/</CODE>)
533process performs many of the functions of the LPRng and BSD
534<CODE>lpd</CODE>
535server.
536On Solaris systems,
537it also stats the
538<CODE>lpNet</CODE>
539server that provides network print services.
540Unfortunately,
541no <I>simple</I> and reliable method of shutting down a running <CODE>lpsched</CODE>
542process
543and the associated network services has been found.
544However,
545it turns out to be very simple to <EM>prevent</EM> the services from
546being started.
547<P>First,
548you will need to locate the <CODE>/etc/rc</CODE> startup files
549that start system services.
550During system startup,
551a set of shell scripts stored in the <CODE>/etc/rc.d</CODE>
552diretories are executed.
553The individual startupfile files are usually links to a
554common one in the <CODE>/etc/init.d</CODE> directory.
555You first need to find the files containing the startup commands.
556This is done as shown below:
557<BLOCKQUOTE><CODE>
558<PRE>
559SUN # cd /
560SUN # grep -l lpsched /etc/rc* /etc/rc*/* init.d/* init.d/*/* >/tmp/files
561SUN # cat /tmp/files
562/etc/rc0.d/K20lp
563/etc/rc2.d/K20lp
564/etc/rc2.d/S80lp
565/etc/init.d/lp
566># ls -l ` cat /tmp/files `
567lrwxrwxr-x 1 root bin 1 Dec 29 23:39 /etc/rc0.d/K20lp -> ../../init.d/lp
568lrwxrwxr-x 1 root bin 1 Dec 29 23:39 /etc/rc2.d/K20lp -> ../../init.d/lp
569lrwxrwxr-x 1 root bin 1 Dec 29 23:39 /etc/rc2.d/S80lp -> ../../init.d/lp
570-rwxr--r-- 5 root sys 460 Sep 1 1998 /etc/rcS.d/K39lp
571</PRE>
572</CODE></BLOCKQUOTE>
573<P>Here is the contents of the typical script file,  with the
574indicated modifications that should be made for testing
575<BLOCKQUOTE><CODE>
576<PRE>
577#!/sbin/sh
578
579#### ADD THE FOLLOWING LINE TO EXIT EARLY
580exit 0
581#### THE REST IS THE USUAL SCRIPT
582case "$1" in
583'start')
584    [ -f /usr/lib/lpsched ] &amp;&amp; /usr/lib/lpsched ;;
585'stop' )
586    [ -f /usr/lib/lpshut ] &amp;&amp; /usr/lib/lpshut ;;
587*)
588    echo "Usage: $0 { start | stop }"
589    exit 1
590esac
591exit 0
592</PRE>
593</CODE></BLOCKQUOTE>
594<P>Next,
595as for the BSD installation,
596we will find all of the printing related commands and rename them.
597You can either rename them one by one,
598or use the script method shown below.
599The minimum of the indicated files should be renamed.
600<BLOCKQUOTE><CODE>
601<PRE>
602SUN # find /usr -type f -name lp\* -print >/etc/printingfiles
603SUN # cat /tmp/printingfiles
604/usr/bin/lp          &lt;---
605/usr/bin/lpstat      &lt;---
606/usr/lib/lp/bin/lp.cat
607/usr/lib/lp/bin/lp.set
608/usr/lib/lp/bin/lp.tell
609/usr/lib/lp/lpNet    &lt;---
610/usr/lib/lp/lpsched  &lt;---
611/usr/lib/lp/lpdata   &lt;---
612/usr/sbin/lpadmin    &lt;---
613/usr/sbin/lpfilter   &lt;---
614/usr/sbin/lpforms    &lt;---
615/usr/sbin/lpmove     &lt;---
616/usr/sbin/lpshut     &lt;---
617/usr/sbin/lpsystem   &lt;---
618/usr/sbin/lpusers    &lt;---
619/usr/ucb/lpc         &lt;---
620/usr/ucb/lpq         &lt;---
621/usr/ucb/lpr         &lt;---
622/usr/ucb/lprm        &lt;---
623/usr/ucb/lptest
624SUN # for i in ` cat /tmp/printingfiles ` ; do
625>  mv $i $i.old
626>  done
627</PRE>
628</CODE></BLOCKQUOTE>
629<P>Next, you find if there is a <I>cron</I> job scheduled
630by the file
631<CODE>/var/spool/cron/crontabs/lp</CODE>
632to periodically update and roll over error logs. 
633If there is, you should
634(after having saved the file)
635remove it.
636<BLOCKQUOTE><CODE>
637<PRE>
638cp /var/spool/cron/crontabs/lp /etc/cron.crontabs.lp
639</PRE>
640</CODE></BLOCKQUOTE>
641<P>Check the <CODE>/etc/inetd.conf</CODE> file for a line like:
642<BLOCKQUOTE><CODE>
643<PRE>
644printer stream tcp nowait root /usr/lib/print/in.lpd in.lpd
645</PRE>
646</CODE></BLOCKQUOTE>
647<P>Comment out this line.
648This line is not present on all systems.
649<P>Now we must <EM>reboot</EM>  the machine.  You can use
650<CODE>reboot</CODE> if you are in a rush,
651and <CODE>shutdown</CODE> if you are not.
652<BLOCKQUOTE><CODE>
653<PRE>
654SUN # reboot
655or
656SUN # shutdown -y "Whooga! Whooga! Dive! Dive! System going down."
657</PRE>
658</CODE></BLOCKQUOTE>
659<P>When the system reboots,
660check to make sure that the
661<CODE>lpd</CODE> server is not listening on port 515.
662<BLOCKQUOTE><CODE>
663<PRE>
664SUN # telnet localhost 515
665Trying 127.0.0.1...
666telnet: Unable to connect to remote host: Connection refused
667</PRE>
668</CODE></BLOCKQUOTE>
669<P>If you do get a connection established
670then you must use <CODE>nlsadmin</CODE> to force the
671<I>tcpip listener</I> to release the port, as illustrated below.
672<BLOCKQUOTE><CODE>
673<PRE>
674SUN # nlsadmin -v tcp
675lpd  \x00020203000000000000000000000000  ENABLED  \
676  NORPC  root  NOMODULES  /var/spool/lp/fifos/listenBSD  #
6770  \x00020ACE000000000000000000000000  ENABLED    \
678  NORPC  root  NOMODULES  /usr/lib/saf/nlps_server  #
679lp  NOADDR  ENABLED  NORPC  root  NOMODULES \
680  /var/spool/lp/fifos/listenS5  #
681SUN # nlsadmin -r lpd tcp
682SUN # nlsadmin -r lp tcp
683</PRE>
684</CODE></BLOCKQUOTE>
685<P>Once you disable this,
686you should try to reconnect to port 515.  If you still cannot,
687then you have a problem  and need to reboot once more.
688<H2><A NAME="ss4.9">4.9 Initial System Testing</A>
689</H2>
690
691<P>We will now run the <CODE>lpd</CODE> executable in the
692<CODE>foreground</CODE> and <CODE>test</CODE> mode,
693and make sure that our system configuration is
694correct.
695It is best to do this with two screens or windows,
696as you will want to observe the output.
697<BLOCKQUOTE><CODE>
698<PRE>
699# > /usr/local/bin/lpd -F
700Fatal error - Another print spooler is using TCP printer port
701# > /usr/local/bin/lpd -F -D1
702...
7031999-04-05-10:02:37.755 astart10 [28903] lpd  Read_file_and_split: \
704  cannot open file '/etc/lpd.perms' - No such file or directory
7051999-04-05-10:02:37.758 astart10 [28903] lpd  Read_file_and_split: \
706  cannot open file '/usr/etc/lpd.perms' - No such file or directory
7071999-04-05-10:02:37.759 astart10 [28903] lpd  Build_printcap_info: \
708  list->count 0, raw->count 3
7091999-04-05-10:02:37.777 astart10 [28903] lpd  lpd: listening socket fd -6
710Fatal error - Another print spooler is using TCP printer port
7111999-04-05-10:02:37.782 astart10 [28903] lpd  Get_max_fd: getrlimit returns 64
7121999-04-05-10:02:37.783 astart10 [28903] lpd  Get_max_fd: returning 64
7131999-04-05-10:02:37.786 astart10 [28903] lpd  cleanup: done, doing killpg \
714   then exit(0)
715</PRE>
716</CODE></BLOCKQUOTE>
717<P>If you get the above error message,
718then you have either not killed off other the running <CODE>lpd</CODE> server
719or you are not starting the <CODE>lpd</CODE> server as ROOT.
720This is the most common error during setup.
721Correct the problem and then restart the server if neccessary.
722You should see the output indicated below:
723<BLOCKQUOTE><CODE>
724<PRE>
725# > /usr/local/bin/lpd -F -D1
7261999-04-05-14:35:14.023 astart27 [2667] Waiting  lpd: LOOP START
7271999-04-05-14:35:14.024 astart27 [2667] Waiting  Get_max_servers: getrlimit returns 256
7281999-04-05-14:35:14.024 astart27 [2667] Waiting  Get_max_servers: returning 128
7291999-04-05-14:35:14.025 astart27 [2667] Waiting  lpd: max_servers 128, active 0
7301999-04-05-14:35:14.025 astart27 [2667] Waiting  lpd: starting select timeout 'yes', 600 sec
731</PRE>
732</CODE></BLOCKQUOTE>
733<P>Now from another window do the following commands:
734<BLOCKQUOTE><CODE>
735<PRE>
736# > lpq -Plp@localhost
737Printer: lp@astart
738 Queue: no printable jobs in queue
739# > lpq
740Printer: lp@astart
741 Queue: no printable jobs in queue
742</PRE>
743</CODE></BLOCKQUOTE>
744<P>At this point your LPRng software has been installed and tested.
745You still need to set up
746<I>Startup Scripts</I>
747to automatically start it at boot time,
748and
749<CODE>/etc/printcap</CODE>
750entries for your printers.
751<H2><A NAME="startup"></A> <A NAME="ss4.10">4.10 Startup Scripts</A>
752</H2>
753
754<P>The purpose of startup scripts is to automatically start the <CODE>lpd</CODE>
755print server at boot time.
756Again,
757the location and contents of these depend strongly on the
758version of the Operating System, and system vendor.
759<H3>SunOS and BSD Derived</H3>
760
761<P>In most of these systems the startup script
762for
763<CODE>lpd</CODE>
764is already present in the
765<CODE>/etc/rc</CODE> files
766and only has to be modified.
767It can be found by using:
768<BLOCKQUOTE><CODE>
769<PRE>
770ASTART # grep -l lp /etc/rc* /etc/rc*/* /etc/rc*/*/*
771/etc/rc
772ASTART # more /etc/rc
773...
774if [ -f /etc/printcap ]; then
775    echo -n ' printer';     /usr/sbin/lpd
776fi
777</PRE>
778</CODE></BLOCKQUOTE>
779<P> Modify this file so that path is to the LPRng <CODE>lpd</CODE> file.
780<H3>Solaris,  Linux, and SysVR4</H3>
781
782<P>These systems have individual startup files for each printing service.
783We need to update the startup files to reference the LPRng executables.
784<BLOCKQUOTE><CODE>
785<PRE>
786SUN # grep -l lp /etc/rc* /etc/rc*/* init.d/* init.d/*/* >/tmp/files
787SUN # cat /tmp/files
788/etc/rc0.d/K20lp
789/etc/rc2.d/K20lp
790/etc/rc2.d/S80lp
791/etc/init.d/lp
792># ls -l ` cat /tmp/files `
793lrwxrwxr-x  1 root  bin  1 Dec 29 23:39 /etc/rc0.d/K20lp -> ../../init.d/lp
794lrwxrwxr-x  1 root  bin  1 Dec 29 23:39 /etc/rc2.d/K20lp -> ../../init.d/lp
795lrwxrwxr-x  1 root  bin  1 Dec 29 23:39 /etc/rc2.d/S80lp -> ../../init.d/lp
796-rwxr--r--  5 root  sys  460 Sep 1 1998 /etc/rcS.d/K39lp
797</PRE>
798</CODE></BLOCKQUOTE>
799<P>Modify the startup files so that they use the LPRng <CODE>lpd</CODE> executable:
800<BLOCKQUOTE><CODE>
801<PRE>
802#!/sbin/sh
803case "$1" in
804'start')
805        [ -f /usr/local/bin/lpd ] &amp;&amp; /usr/local/bin/lpd
806        ;;
807'stop')
808    echo "Shutting down lpd: \c"
809    kill -2 `cat /var/run/lpd*` >/dev/null 2>1;
810        ;;
811
812*)
813        echo "Usage: $0 { start | stop }"
814        exit 1
815esac
816exit 0
817</PRE>
818</CODE></BLOCKQUOTE>
819<H2><A NAME="lpsimulation"></A> <A NAME="ss4.11">4.11 Replacing UNIX SystemV lp, lpstat Printing Services</A>
820</H2>
821
822<P>Many UNIX utilities in the Solaris and HP UNIX environment use the
823UNIX System V <CODE>lp</CODE> and <CODE>lpstat</CODE>
824programs.
825It is almost impossible to modify the programs themselves,
826as many are <EM>vintage</EM> software that is unsupported or which would
827be too costly to update.
828<P>In order to support these applications,
829LPRng provides simulation for the
830<CODE>lp</CODE>,
831<CODE>lpstat</CODE>,
832and
833<CODE>clean</CODE>
834commands.
835<P>The LPRng <CODE>lpstat</CODE> command is a modified version of the
836<CODE>lpq</CODE> command,
837and accepts the <CODE>lpstat</CODE> command line options and tries to return
838status in an <CODE>lpstat</CODE> format.
839<P>If the <CODE>lpr</CODE> program is invoked with the name <CODE>lp</CODE>,
840it will simulate the <CODE>lp</CODE>options.
841Finally, if the <CODE>lprm</CODE> program is invoked with the name <CODE>cancel</CODE>,
842it will simulate the <CODE>lp</CODE>options.
843This can be done by using symbolic links or copying the programs.
844<P>Note that many of the <CODE>vintage</CODE> applications have fully qualified
845paths to the <CODE>lp</CODE> and <CODE>lpstat</CODE> executables,
846so it will be nessary to copy them to the original program locations.
847<BLOCKQUOTE><CODE>
848<PRE>
849# original - /usr/bin/lp
850# original - /usr/bin/lpstat
851cd /usr/local/bin
852cp lpr /usr/bin/lp
853cp lpstat /usr/bin/lpstat
854cp lprm /usr/bin/cancel
855</PRE>
856</CODE></BLOCKQUOTE>
857<P>See the man pages for lp, lpstat, and cancel in the LPRng/man directory.
858Not all the functions of the original
859programs are supported and
860these man pages should be installed to replace the original
861lp, etc, man pages.
862<HR>
863<A HREF="LPRng-HOWTO-5.html">Next</A>
864<A HREF="LPRng-HOWTO-3.html">Previous</A>
865<A HREF="LPRng-HOWTO.html#toc4">Contents</A>
866</BODY>
867</HTML>
Note: See TracBrowser for help on using the repository browser.