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 |
---|
18 | and the database files. |
---|
19 | This section deals with generating and installing the executable |
---|
20 | files. |
---|
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>, |
---|
30 | and |
---|
31 | <EM><CODE>lpc</CODE></EM> - |
---|
32 | client programs for printing, |
---|
33 | status 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> |
---|
40 | and the <CODE>lpd</CODE> server in |
---|
41 | <CODE>/usr/local/sbin</CODE>. |
---|
42 | By tradition, |
---|
43 | UNIX systems have installed printer utilities in |
---|
44 | in 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>, |
---|
51 | and |
---|
52 | <CODE>/usr/etc/</CODE>. |
---|
53 | During 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> |
---|
57 | file contains the printer database information. |
---|
58 | Information in this file can override the |
---|
59 | <CODE>/etc/lpd.conf</CODE> |
---|
60 | and default configuration information. |
---|
61 | The |
---|
62 | <CODE> |
---|
63 | <A HREF="LPRng-HOWTO-11.html#lpdconf">/etc/lpd.conf</A></CODE> |
---|
64 | file contains configuration |
---|
65 | information for the server and client programs. |
---|
66 | The compiled in defaults should be suitable for most small user installations. |
---|
67 | The |
---|
68 | <CODE> |
---|
69 | <A HREF="LPRng-HOWTO-14.html#lpdpermsref">/etc/lpd.perms</A></CODE> |
---|
70 | file 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> |
---|
81 | and install it. |
---|
82 | See 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>. |
---|
85 | and install it. |
---|
86 | See the directions in the GNU Zip distribution for details. |
---|
87 | This program will be referred to as |
---|
88 | <CODE>gmake</CODE> in the installation instructions.</LI> |
---|
89 | <LI>Obtain an ANSI C compiler. |
---|
90 | The GCC compiler (from the |
---|
91 | <A HREF="http://prep.ai.mit.edu">GNU Software Mirror Sites</A>) |
---|
92 | is 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, |
---|
100 | the LPRng distribution will have the name |
---|
101 | <CODE>LPRng-<version>.tgz</CODE>. |
---|
102 | <P>Unpack, configure, |
---|
103 | compile, and install, |
---|
104 | and initialize the distribution using: |
---|
105 | <BLOCKQUOTE><CODE> |
---|
106 | <PRE> |
---|
107 | gunzip -c LPRng-<version>.tgz | tar xvf - |
---|
108 | cd LPRng-<version> |
---|
109 | # see discussion below for configuration options |
---|
110 | ./configure |
---|
111 | gmake clean all |
---|
112 | su # you must do the following commands as root |
---|
113 | gmake install |
---|
114 | # if you have not installed LPRng before, |
---|
115 | # install default lpd.perms and lpd.conf file in /etc |
---|
116 | if [ ! -f /etc/lpd.perms ]; then |
---|
117 | make default; |
---|
118 | fi; |
---|
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> |
---|
129 | script will determine the type of system and establish a set of defaults |
---|
130 | for compilation and installation. |
---|
131 | The <CODE>LPRng/INSTALL</CODE> |
---|
132 | file contains detailed descriptions of the various configuration options and |
---|
133 | capabilities. |
---|
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 |
---|
137 | errors.<BR> |
---|
138 | Try <CODE>gcc</CODE> instead of your vendor's C compiler. |
---|
139 | This can be done either by setting |
---|
140 | the |
---|
141 | <CODE>CC</CODE> environment variable or using the |
---|
142 | <CODE>--with-cc</CODE> configure option. |
---|
143 | <BLOCKQUOTE><CODE> |
---|
144 | <PRE> |
---|
145 | CC=gcc ./configure |
---|
146 | OR |
---|
147 | configure --with-cc=gcc |
---|
148 | </PRE> |
---|
149 | </CODE></BLOCKQUOTE> |
---|
150 | |
---|
151 | </LI> |
---|
152 | <LI>Missing libraries or include files.<BR> |
---|
153 | Usually this is caused when include files are in |
---|
154 | <CODE>/usr/local/include</CODE> |
---|
155 | and libraries are in |
---|
156 | <CODE>/usr/local/include</CODE> |
---|
157 | and these paths are not searched or used by the compiler. |
---|
158 | This can be fixed by setting the |
---|
159 | <CODE>CPPFLAGS</CODE> and <CODE>LDFLAGS</CODE> environment variables, |
---|
160 | or using the |
---|
161 | <CODE>--with-cppopts=</CODE> |
---|
162 | and |
---|
163 | <CODE>--with-ldopts=</CODE> |
---|
164 | configure options. |
---|
165 | <BLOCKQUOTE><CODE> |
---|
166 | <PRE> |
---|
167 | CPPFLAGS="-I/usr/local/include -I/usr/include/kerberosIV" \ |
---|
168 | LDFLAGS="-L/usr/local/lib -L/usr/lib/kerberosIV" \ |
---|
169 | ./configure |
---|
170 | OR |
---|
171 | configure --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> |
---|
177 | See the detailed discussions in the INSTALL file, |
---|
178 | especially the section dealing with the |
---|
179 | <CODE>--with-lpddir</CODE>, |
---|
180 | <CODE>--exec-prefix=</CODE>, |
---|
181 | <CODE>--bindir=</CODE>, |
---|
182 | <CODE>--sbindir=</CODE>, |
---|
183 | and other basic |
---|
184 | <CODE>configure</CODE> |
---|
185 | options.</LI> |
---|
186 | </OL> |
---|
187 | <P>The <CODE>configure</CODE> and <CODE>make</CODE> steps must be run on |
---|
188 | the target host, |
---|
189 | especially if the target host has a different version of the operating system. |
---|
190 | This is extremely important for SunOS or Solaris, |
---|
191 | where |
---|
192 | there tend to be changes in the system's include files between |
---|
193 | versions |
---|
194 | as 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> |
---|
197 | for 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 |
---|
202 | individual users, |
---|
203 | administrators of large sites or which need to support |
---|
204 | <I>lightweight print clients</I> |
---|
205 | will need to use the following configure options. |
---|
206 | <OL> |
---|
207 | <LI><CODE>--disable-force_localhost</CODE><BR> |
---|
208 | The default LPRng configuration assumes that all printing will be done |
---|
209 | via a <CODE>lpd</CODE> print spooler running on the local host system. |
---|
210 | However, |
---|
211 | many larger sites prefer that all users do their printing via a |
---|
212 | few central servers, |
---|
213 | and do not run |
---|
214 | <CODE>lpd</CODE> servers on user systems. |
---|
215 | The |
---|
216 | <CODE>--disable-force_localhost</CODE> |
---|
217 | configuration will simply this type of operation by eliminating the need for |
---|
218 | a |
---|
219 | <CODE>/etc/lpd.conf</CODE> file to override the <CODE>force_localhost</CODE> option. |
---|
220 | Example: |
---|
221 | <BLOCKQUOTE><CODE> |
---|
222 | <PRE> |
---|
223 | ./configure --disable-force_localhost |
---|
224 | </PRE> |
---|
225 | </CODE></BLOCKQUOTE> |
---|
226 | </LI> |
---|
227 | <LI><CODE>--disable-lpd_bounce</CODE> |
---|
228 | The default LPRng configuration assumes that each |
---|
229 | <CODE>lpd</CODE> server will process and modify print jobs as they are forwarded |
---|
230 | from server to server. |
---|
231 | While this is usually the desired operation on small sites or on individual systems, |
---|
232 | this is usually not the desired operation on sites running central servers, |
---|
233 | as will requires distributing filter software to all the user workstations. |
---|
234 | Example: |
---|
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 |
---|
247 | and other information used by LPRng. |
---|
248 | If your system does not have an <CODE>/etc/printcap</CODE> file, |
---|
249 | then the following is suitable for initial testing and configuration: |
---|
250 | <BLOCKQUOTE><CODE> |
---|
251 | <PRE> |
---|
252 | # test printcap file |
---|
253 | lp: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> |
---|
259 | file contains settings that override the defaults provided at compile time. |
---|
260 | You will find a prototype or template <CODE>ifhp.conf</CODE> file in the LPRng distribution. |
---|
261 | You can install this by using: |
---|
262 | <BLOCKQUOTE><CODE> |
---|
263 | <PRE> |
---|
264 | astart > cd LPRng |
---|
265 | astart > su |
---|
266 | ASTART # make init |
---|
267 | or |
---|
268 | ASTART # cp /etc/ifhp.conf /etc |
---|
269 | ASTART # 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, |
---|
276 | the <CODE>lpd</CODE> server is run as a ROOT (user 0) |
---|
277 | process. |
---|
278 | (This is true not only for LPRng, but also for all |
---|
279 | other system processes which are started at boot time.) |
---|
280 | However, |
---|
281 | normally LPRng will do operations as a non-privileged user and group |
---|
282 | which 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 |
---|
285 | in the <CODE>/etc/lpd.conf</CODE> configuration file |
---|
286 | or 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 |
---|
289 | system security: |
---|
290 | <OL> |
---|
291 | <LI>Create a user and group <CODE>daemon</CODE> on the system. |
---|
292 | This user does not need login privileges, |
---|
293 | but will need a home directory if secure authentication |
---|
294 | such as Kerberos or PGP will be done.</LI> |
---|
295 | <LI>The <CODE>/etc/lpd.conf</CODE> |
---|
296 | file should be owned by root (user 0), |
---|
297 | and should have read-only (0444) permissions.</LI> |
---|
298 | <LI>The <CODE>/etc/printcap</CODE> |
---|
299 | file should be owned by root (user 0), |
---|
300 | and should have read-only (0444) permissions.</LI> |
---|
301 | <LI>The spool and working directories used by LPRng should be |
---|
302 | owned by user <CODE>daemon</CODE>, group <CODE>daemon</CODE>, |
---|
303 | and 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> |
---|
309 | program is used to make sure that |
---|
310 | the spool directories and files used by LPRng have the correct permissions |
---|
311 | and are in place. |
---|
312 | By default, |
---|
313 | <CODE>checkpc</CODE> will check permissions and report if there are any problems. |
---|
314 | You should run this as <CODE>root</CODE>. |
---|
315 | For example: |
---|
316 | <BLOCKQUOTE><CODE> |
---|
317 | <PRE> |
---|
318 | % astart > su |
---|
319 | #>cd LPRng/src |
---|
320 | #>./checkpc |
---|
321 | Warning - No configuration file found in '/etc/lpd.conf:/usr/etc/lpd.conf' |
---|
322 | Warning - No lpd only printcap file found in '/etc/lpd_printcap,/usr/etc/lpd_printcap' |
---|
323 | Warning - ** cannot open '/var/run/lpd.printer' - 'Permission denied' |
---|
324 | Warning - bad directory - /var/spool/lpd/lp |
---|
325 | Warning - 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> |
---|
330 | file is missing. |
---|
331 | This is not a serious problem if the system defaults are to be used, |
---|
332 | but you might want to put the default <CODE>LPRng/lpd.conf</CODE> file from the |
---|
333 | distribution in place. |
---|
334 | <P>The <I>lpd only printcap</I> |
---|
335 | message is usually of concern to administrators who wish to use some of |
---|
336 | LPRng's more exotic configuration options. |
---|
337 | It is possible to have separarte printcap databases for client and server programs. |
---|
338 | This is useful when printcap files get extremely large and cuts down |
---|
339 | substantially on system management problems. |
---|
340 | <P>The permission denied message for <CODE>/var/run/lpd.printer</CODE> is more serious, |
---|
341 | as 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 |
---|
343 | bad 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. |
---|
345 | You 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 |
---|
351 | LPRng version LPRng-3.6.1 |
---|
352 | DaemonUID 1, DaemonGID 12 |
---|
353 | Using Config file '/etc/lpd.conf:/usr/etc/lpd.conf' |
---|
354 | Checking for configuration files '/etc/lpd.conf:/usr/etc/lpd.conf' |
---|
355 | Warning - No configuration file found in '/etc/lpd.conf:/usr/etc/lpd.conf' |
---|
356 | Checking for printcap files '/etc/printcap,/usr/etc/printcap' |
---|
357 | found '/etc/printcap', mod 0100644 |
---|
358 | Checking for lpd only printcap files |
---|
359 | '/etc/lpd_printcap,/usr/etc/lpd_printcap' |
---|
360 | Warning - No lpd only printcap file found in |
---|
361 | '/etc/lpd_printcap,/usr/etc/lpd_printcap' |
---|
362 | LPD lockfile '/var/run/lpd.printer' |
---|
363 | checking '/var/run/lpd.printer' file |
---|
364 | Names |
---|
365 | :lp=lp |
---|
366 | All |
---|
367 | :lp |
---|
368 | Printcap Information |
---|
369 | lp |
---|
370 | :force_localhost |
---|
371 | :lp=lw4@astart4.astart.com |
---|
372 | :sd=/var/spool/lpd/lp |
---|
373 | Checking printcap info |
---|
374 | Checking 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 |
---|
388 | Warning - No configuration file found in '/etc/lpd.conf:/usr/etc/lpd.conf' |
---|
389 | Warning - 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 |
---|
393 | printing 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, |
---|
397 | there is always the problem with undetected errors in the LPRng |
---|
398 | software that, |
---|
399 | when exploited, |
---|
400 | could cause severe system problems. |
---|
401 | The 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> |
---|
404 | programs without root permission. |
---|
405 | This is the default operation for LPRng, |
---|
406 | in contrast to other print spooling software. |
---|
407 | <P>A remaining problem is the fact that on most UNIX |
---|
408 | platforms, |
---|
409 | <CODE>lpd</CODE> requires root permissions to open port 515. |
---|
410 | One option is to have the <CODE>lpd</CODE> server drop root permissions |
---|
411 | soon after binding to this port and before accepting any user |
---|
412 | commands. |
---|
413 | However, |
---|
414 | in order to be compatible with RFC1179, |
---|
415 | <CODE>lpd</CODE> must originate connections from a <I>reserved</I> |
---|
416 | port in the range 721-731, |
---|
417 | although in practice port 1-1023 seems to be acceptible. |
---|
418 | <P>If interoperability with existing print spoolers is not desired, |
---|
419 | then it is <I>trivial</I> |
---|
420 | to configure LPRng using the <CODE>lpd.conf</CODE> |
---|
421 | file or by modifying the compile time |
---|
422 | <CODE>lpd_port</CODE> |
---|
423 | value in the file or the <CODE>LPRng/src/vars.c</CODE> |
---|
424 | so that all the software will run |
---|
425 | as client programs. |
---|
426 | For example, |
---|
427 | in the <CODE>/etc/lpd.conf</CODE> file, |
---|
428 | you only need to change the indicated lines: |
---|
429 | <BLOCKQUOTE><CODE> |
---|
430 | <PRE> |
---|
431 | # Purpose: lpd port |
---|
432 | # default lpd_port=printer |
---|
433 | lpd_port=2000 |
---|
434 | </PRE> |
---|
435 | </CODE></BLOCKQUOTE> |
---|
436 | <P>Now all the LPRng software will use port 2000 to transfer jobs and |
---|
437 | commands. |
---|
438 | You 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 |
---|
444 | spooler, |
---|
445 | and test the functionality of the LPRng <CODE>lpd</CODE> |
---|
446 | programs. |
---|
447 | Unfortunately, |
---|
448 | this process is fairly system dependent, |
---|
449 | and requires a small amount of system expertise. |
---|
450 | In addition to these general directions, |
---|
451 | you 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, |
---|
457 | such as SunOS, |
---|
458 | BSD derived systems, |
---|
459 | and Linux based systems. |
---|
460 | These systems use an <CODE>lpd</CODE> print server, |
---|
461 | as does LPRng. |
---|
462 | <P>We first kill the currently running <CODE>lpd</CODE> process. |
---|
463 | While there may be a system shutdown script |
---|
464 | in the <CODE>/etc/rc.d/</CODE> directory or other location for this, |
---|
465 | do not bother using it. |
---|
466 | <BLOCKQUOTE><CODE> |
---|
467 | <PRE> |
---|
468 | # most BSD Systems |
---|
469 | ps -auxw |grep lpd |
---|
470 | # Kill it twice |
---|
471 | kill (pid of lpd server) |
---|
472 | # This should report an error - if not then lpd did not terminate |
---|
473 | kill (pid of lpd server) |
---|
474 | # |
---|
475 | |
---|
476 | Example: |
---|
477 | astart % ps -axuw |grep lpd |
---|
478 | papowell 23932 0.0 0.3 224 184 p3 S+ 10:40AM 0:00.01 grep lpd |
---|
479 | daemon 17763 0.0 0.2 448 120 ?? IWs 29Mar99 0:01.35 (lpd) |
---|
480 | astart % kill 135 |
---|
481 | astart % kill 135 |
---|
482 | 135: No such process |
---|
483 | </PRE> |
---|
484 | </CODE></BLOCKQUOTE> |
---|
485 | <P>Next, |
---|
486 | you should remove or rename the existing print system executables. |
---|
487 | The following example shows how to use the |
---|
488 | <CODE>find</CODE> utility to track down candidates. |
---|
489 | <BLOCKQUOTE><CODE> |
---|
490 | <PRE> |
---|
491 | astart# find /usr -type f -name lp\* -print >/tmp/candidates |
---|
492 | astart# find /sbin -type f -name lp\* -print >>/tmp/candidates |
---|
493 | astart# cat /tmp/candidates |
---|
494 | /usr/bin/lpunlock |
---|
495 | /usr/bin/lpqall.faces |
---|
496 | /usr/bin/lpq <---- old |
---|
497 | /usr/bin/lpr <---- old |
---|
498 | /usr/bin/lprm <---- 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 <--- old |
---|
509 | /usr/sbin/lpd <--- old |
---|
510 | /usr/sbin/lpf <--- old |
---|
511 | /usr/local/bin/lpc <-- LPRng |
---|
512 | /usr/local/bin/lpq <-- LPRng |
---|
513 | /usr/local/bin/lpr <-- LPRng |
---|
514 | /usr/local/bin/lprm <-- LPRng |
---|
515 | /usr/local/sbin/lpd <-- LPRng |
---|
516 | astart # mv /usr/bin/lpq /usr/bin/lpq.old |
---|
517 | astart # mv /usr/bin/lpr /usr/bin/lpr.old |
---|
518 | astart # mv /usr/bin/lprm /usr/bin/lprm.old |
---|
519 | astart # mv /usr/sbin/lpc /usr/sbin/lpc.old |
---|
520 | astart # mv /usr/sbin/lpd /usr/sbin/lpd.old |
---|
521 | astart # 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 |
---|
528 | any support for RFC1179 network printing (Berkeley LPD). |
---|
529 | Support for this was added by various manufacture specific methods. |
---|
530 | Unfortunately, |
---|
531 | there are a wide range of possibilities. |
---|
532 | <P>The <CODE>lpsched</CODE> process (<CODE>/usr/lib/lp/lpsched/</CODE>) |
---|
533 | process performs many of the functions of the LPRng and BSD |
---|
534 | <CODE>lpd</CODE> |
---|
535 | server. |
---|
536 | On Solaris systems, |
---|
537 | it also stats the |
---|
538 | <CODE>lpNet</CODE> |
---|
539 | server that provides network print services. |
---|
540 | Unfortunately, |
---|
541 | no <I>simple</I> and reliable method of shutting down a running <CODE>lpsched</CODE> |
---|
542 | process |
---|
543 | and the associated network services has been found. |
---|
544 | However, |
---|
545 | it turns out to be very simple to <EM>prevent</EM> the services from |
---|
546 | being started. |
---|
547 | <P>First, |
---|
548 | you will need to locate the <CODE>/etc/rc</CODE> startup files |
---|
549 | that start system services. |
---|
550 | During system startup, |
---|
551 | a set of shell scripts stored in the <CODE>/etc/rc.d</CODE> |
---|
552 | diretories are executed. |
---|
553 | The individual startupfile files are usually links to a |
---|
554 | common one in the <CODE>/etc/init.d</CODE> directory. |
---|
555 | You first need to find the files containing the startup commands. |
---|
556 | This is done as shown below: |
---|
557 | <BLOCKQUOTE><CODE> |
---|
558 | <PRE> |
---|
559 | SUN # cd / |
---|
560 | SUN # grep -l lpsched /etc/rc* /etc/rc*/* init.d/* init.d/*/* >/tmp/files |
---|
561 | SUN # 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 ` |
---|
567 | lrwxrwxr-x 1 root bin 1 Dec 29 23:39 /etc/rc0.d/K20lp -> ../../init.d/lp |
---|
568 | lrwxrwxr-x 1 root bin 1 Dec 29 23:39 /etc/rc2.d/K20lp -> ../../init.d/lp |
---|
569 | lrwxrwxr-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 |
---|
574 | indicated modifications that should be made for testing |
---|
575 | <BLOCKQUOTE><CODE> |
---|
576 | <PRE> |
---|
577 | #!/sbin/sh |
---|
578 | |
---|
579 | #### ADD THE FOLLOWING LINE TO EXIT EARLY |
---|
580 | exit 0 |
---|
581 | #### THE REST IS THE USUAL SCRIPT |
---|
582 | case "$1" in |
---|
583 | 'start') |
---|
584 | [ -f /usr/lib/lpsched ] && /usr/lib/lpsched ;; |
---|
585 | 'stop' ) |
---|
586 | [ -f /usr/lib/lpshut ] && /usr/lib/lpshut ;; |
---|
587 | *) |
---|
588 | echo "Usage: $0 { start | stop }" |
---|
589 | exit 1 |
---|
590 | esac |
---|
591 | exit 0 |
---|
592 | </PRE> |
---|
593 | </CODE></BLOCKQUOTE> |
---|
594 | <P>Next, |
---|
595 | as for the BSD installation, |
---|
596 | we will find all of the printing related commands and rename them. |
---|
597 | You can either rename them one by one, |
---|
598 | or use the script method shown below. |
---|
599 | The minimum of the indicated files should be renamed. |
---|
600 | <BLOCKQUOTE><CODE> |
---|
601 | <PRE> |
---|
602 | SUN # find /usr -type f -name lp\* -print >/etc/printingfiles |
---|
603 | SUN # cat /tmp/printingfiles |
---|
604 | /usr/bin/lp <--- |
---|
605 | /usr/bin/lpstat <--- |
---|
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 <--- |
---|
610 | /usr/lib/lp/lpsched <--- |
---|
611 | /usr/lib/lp/lpdata <--- |
---|
612 | /usr/sbin/lpadmin <--- |
---|
613 | /usr/sbin/lpfilter <--- |
---|
614 | /usr/sbin/lpforms <--- |
---|
615 | /usr/sbin/lpmove <--- |
---|
616 | /usr/sbin/lpshut <--- |
---|
617 | /usr/sbin/lpsystem <--- |
---|
618 | /usr/sbin/lpusers <--- |
---|
619 | /usr/ucb/lpc <--- |
---|
620 | /usr/ucb/lpq <--- |
---|
621 | /usr/ucb/lpr <--- |
---|
622 | /usr/ucb/lprm <--- |
---|
623 | /usr/ucb/lptest |
---|
624 | SUN # 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 |
---|
630 | by the file |
---|
631 | <CODE>/var/spool/cron/crontabs/lp</CODE> |
---|
632 | to periodically update and roll over error logs. |
---|
633 | If there is, you should |
---|
634 | (after having saved the file) |
---|
635 | remove it. |
---|
636 | <BLOCKQUOTE><CODE> |
---|
637 | <PRE> |
---|
638 | cp /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> |
---|
644 | printer stream tcp nowait root /usr/lib/print/in.lpd in.lpd |
---|
645 | </PRE> |
---|
646 | </CODE></BLOCKQUOTE> |
---|
647 | <P>Comment out this line. |
---|
648 | This 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, |
---|
651 | and <CODE>shutdown</CODE> if you are not. |
---|
652 | <BLOCKQUOTE><CODE> |
---|
653 | <PRE> |
---|
654 | SUN # reboot |
---|
655 | or |
---|
656 | SUN # shutdown -y "Whooga! Whooga! Dive! Dive! System going down." |
---|
657 | </PRE> |
---|
658 | </CODE></BLOCKQUOTE> |
---|
659 | <P>When the system reboots, |
---|
660 | check to make sure that the |
---|
661 | <CODE>lpd</CODE> server is not listening on port 515. |
---|
662 | <BLOCKQUOTE><CODE> |
---|
663 | <PRE> |
---|
664 | SUN # telnet localhost 515 |
---|
665 | Trying 127.0.0.1... |
---|
666 | telnet: Unable to connect to remote host: Connection refused |
---|
667 | </PRE> |
---|
668 | </CODE></BLOCKQUOTE> |
---|
669 | <P>If you do get a connection established |
---|
670 | then 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> |
---|
674 | SUN # nlsadmin -v tcp |
---|
675 | lpd \x00020203000000000000000000000000 ENABLED \ |
---|
676 | NORPC root NOMODULES /var/spool/lp/fifos/listenBSD # |
---|
677 | 0 \x00020ACE000000000000000000000000 ENABLED \ |
---|
678 | NORPC root NOMODULES /usr/lib/saf/nlps_server # |
---|
679 | lp NOADDR ENABLED NORPC root NOMODULES \ |
---|
680 | /var/spool/lp/fifos/listenS5 # |
---|
681 | SUN # nlsadmin -r lpd tcp |
---|
682 | SUN # nlsadmin -r lp tcp |
---|
683 | </PRE> |
---|
684 | </CODE></BLOCKQUOTE> |
---|
685 | <P>Once you disable this, |
---|
686 | you should try to reconnect to port 515. If you still cannot, |
---|
687 | then 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, |
---|
693 | and make sure that our system configuration is |
---|
694 | correct. |
---|
695 | It is best to do this with two screens or windows, |
---|
696 | as you will want to observe the output. |
---|
697 | <BLOCKQUOTE><CODE> |
---|
698 | <PRE> |
---|
699 | # > /usr/local/bin/lpd -F |
---|
700 | Fatal error - Another print spooler is using TCP printer port |
---|
701 | # > /usr/local/bin/lpd -F -D1 |
---|
702 | ... |
---|
703 | 1999-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 |
---|
705 | 1999-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 |
---|
707 | 1999-04-05-10:02:37.759 astart10 [28903] lpd Build_printcap_info: \ |
---|
708 | list->count 0, raw->count 3 |
---|
709 | 1999-04-05-10:02:37.777 astart10 [28903] lpd lpd: listening socket fd -6 |
---|
710 | Fatal error - Another print spooler is using TCP printer port |
---|
711 | 1999-04-05-10:02:37.782 astart10 [28903] lpd Get_max_fd: getrlimit returns 64 |
---|
712 | 1999-04-05-10:02:37.783 astart10 [28903] lpd Get_max_fd: returning 64 |
---|
713 | 1999-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, |
---|
718 | then you have either not killed off other the running <CODE>lpd</CODE> server |
---|
719 | or you are not starting the <CODE>lpd</CODE> server as ROOT. |
---|
720 | This is the most common error during setup. |
---|
721 | Correct the problem and then restart the server if neccessary. |
---|
722 | You should see the output indicated below: |
---|
723 | <BLOCKQUOTE><CODE> |
---|
724 | <PRE> |
---|
725 | # > /usr/local/bin/lpd -F -D1 |
---|
726 | 1999-04-05-14:35:14.023 astart27 [2667] Waiting lpd: LOOP START |
---|
727 | 1999-04-05-14:35:14.024 astart27 [2667] Waiting Get_max_servers: getrlimit returns 256 |
---|
728 | 1999-04-05-14:35:14.024 astart27 [2667] Waiting Get_max_servers: returning 128 |
---|
729 | 1999-04-05-14:35:14.025 astart27 [2667] Waiting lpd: max_servers 128, active 0 |
---|
730 | 1999-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 |
---|
737 | Printer: lp@astart |
---|
738 | Queue: no printable jobs in queue |
---|
739 | # > lpq |
---|
740 | Printer: 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. |
---|
745 | You still need to set up |
---|
746 | <I>Startup Scripts</I> |
---|
747 | to automatically start it at boot time, |
---|
748 | and |
---|
749 | <CODE>/etc/printcap</CODE> |
---|
750 | entries 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> |
---|
755 | print server at boot time. |
---|
756 | Again, |
---|
757 | the location and contents of these depend strongly on the |
---|
758 | version 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 |
---|
762 | for |
---|
763 | <CODE>lpd</CODE> |
---|
764 | is already present in the |
---|
765 | <CODE>/etc/rc</CODE> files |
---|
766 | and only has to be modified. |
---|
767 | It can be found by using: |
---|
768 | <BLOCKQUOTE><CODE> |
---|
769 | <PRE> |
---|
770 | ASTART # grep -l lp /etc/rc* /etc/rc*/* /etc/rc*/*/* |
---|
771 | /etc/rc |
---|
772 | ASTART # more /etc/rc |
---|
773 | ... |
---|
774 | if [ -f /etc/printcap ]; then |
---|
775 | echo -n ' printer'; /usr/sbin/lpd |
---|
776 | fi |
---|
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. |
---|
783 | We need to update the startup files to reference the LPRng executables. |
---|
784 | <BLOCKQUOTE><CODE> |
---|
785 | <PRE> |
---|
786 | SUN # grep -l lp /etc/rc* /etc/rc*/* init.d/* init.d/*/* >/tmp/files |
---|
787 | SUN # 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 ` |
---|
793 | lrwxrwxr-x 1 root bin 1 Dec 29 23:39 /etc/rc0.d/K20lp -> ../../init.d/lp |
---|
794 | lrwxrwxr-x 1 root bin 1 Dec 29 23:39 /etc/rc2.d/K20lp -> ../../init.d/lp |
---|
795 | lrwxrwxr-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 |
---|
803 | case "$1" in |
---|
804 | 'start') |
---|
805 | [ -f /usr/local/bin/lpd ] && /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 |
---|
815 | esac |
---|
816 | exit 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 |
---|
823 | UNIX System V <CODE>lp</CODE> and <CODE>lpstat</CODE> |
---|
824 | programs. |
---|
825 | It is almost impossible to modify the programs themselves, |
---|
826 | as many are <EM>vintage</EM> software that is unsupported or which would |
---|
827 | be too costly to update. |
---|
828 | <P>In order to support these applications, |
---|
829 | LPRng provides simulation for the |
---|
830 | <CODE>lp</CODE>, |
---|
831 | <CODE>lpstat</CODE>, |
---|
832 | and |
---|
833 | <CODE>clean</CODE> |
---|
834 | commands. |
---|
835 | <P>The LPRng <CODE>lpstat</CODE> command is a modified version of the |
---|
836 | <CODE>lpq</CODE> command, |
---|
837 | and accepts the <CODE>lpstat</CODE> command line options and tries to return |
---|
838 | status in an <CODE>lpstat</CODE> format. |
---|
839 | <P>If the <CODE>lpr</CODE> program is invoked with the name <CODE>lp</CODE>, |
---|
840 | it will simulate the <CODE>lp</CODE>options. |
---|
841 | Finally, if the <CODE>lprm</CODE> program is invoked with the name <CODE>cancel</CODE>, |
---|
842 | it will simulate the <CODE>lp</CODE>options. |
---|
843 | This 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 |
---|
845 | paths to the <CODE>lp</CODE> and <CODE>lpstat</CODE> executables, |
---|
846 | so 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 |
---|
851 | cd /usr/local/bin |
---|
852 | cp lpr /usr/bin/lp |
---|
853 | cp lpstat /usr/bin/lpstat |
---|
854 | cp 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. |
---|
858 | Not all the functions of the original |
---|
859 | programs are supported and |
---|
860 | these man pages should be installed to replace the original |
---|
861 | lp, 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> |
---|