Typo
[linux_from_scratch_hints.git] / OLD / printing.txt
blobe22efbbc9355f0b7fd8863c5ec7ccfeb8f28dc00
1 TITLE:          Printing on LFS
2 LFS VERSION:    any
3 AUTHOR:         Wolfgang Arendt <wolare@gmx.de>
5 SYNOPSIS:
6         This hint describes, how to set up basic printing.  We are
7         assuming local networking is enabled, sections 9.1 through 9.6
8         of the book.
9  
10 HINT:
12 Table of contents
14      * Introduction
15      * About this hint
16      * Packages
17      * Prerequisites
18      * Hardware
19      * Kernel
20      * Users and groups:
21      * apsfilter
22      * Building gdbm
23      * Building LPRng
24      * Building Ghostscript
25      * Building psutils
26      * Installing a2ps
27      * Building apsfilter
28      * Sources and disclaimer
29      * Contributions
30      * Further information
32 Introduction
34    We will build LPRng with gdbm support. It will run as user lp, member
35    of the daemon group. In this example, the GID of the group daemon is 5
36    and so is the UID of the user lp. Please modify all commands to fit
37    your environment. All components will install their configuration into
38    the /etc directory. Moreover we will install Ghostscript as printer
39    driver, assisted by a2ps, the "any to Postscript" converter, apsfilter
40    and psutils.
42 About this hint
44    This hint is a merge of the following documents:
46    printing.txt
47           by Fabio Fracassi <f.fracassi@gmx.net>
49    print.txt
50           by ktb <x.y.f@home.com>
52    ghostscript.txt
53           by Wolfgang Arendt <wolare@gmx.de>
55    printing2.txt
56           by Wolfgang Arendt <wolare@gmx.de>
58 Packages
60    The basic printing system consists of the following packages:
62    gdbm-1.8.0.tar.gz
63           ftp://ftp.gnu.org/gnu/gdbm/
65    LPRng-3.8.4.tgz
66           ftp://ftp.lprng.com/pub/LPRng/LPRng/
68    psutils-p17.tar.gz
69           ftp://ftp.dcs.ed.ac.uk/pub/ajcd/
71    a2ps-4.13:a2ps-4.13
72           ftp://ftp.enst.fr/pub/unix/a2ps/
74    apsfilter-7.1.1.tar.gz
75           http://www.apsfilter.org/download/
77    ghostscript-7.00.tar.gz
78           ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/
80    Standard fonts for ghostscript
81           ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/fonts/ghostscript-fonts-std-6.0.tar.gz
83    Optional fonts for ghostscript
84           ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/fonts/ghostscript-fonts-other-6.0.tar.gz
86 Prerequisites
88   Hardware
90    You need a supported printer. Check:
92    http://www.linuxprinting.org/printer_list.cgi
94    for a list of supported hardware.
96   Kernel
98    You need a kernel with support for the interface, your printer is
99    connected to and printing support in general.
101    To check, whether this is the case, try the following:
103    For a local printer on the first parallel port try:
104   echo "bla\\f" > /dev/lp0
106    The printer should react in any way (to be more precisely: it should
107    print one page with the word "bla" on it).
109    For a networked printer try pinging the IP number of the printer.
111    If one of those worked, you are ready to install the software.
113    If the printer did not respond make sure it is connected to the
114    computer correctly i.e., check cables, make sure the network is
115    working correctly and that there is kernel support for the printer.
117    You can check, whether your kernel supports the parallel port, by
118    running
120   cat /usr/src/linux/.config | grep CONFIG_PARPORT
122    You can check, whether you have printing support in the kernel, by
123    running:
125   cat /usr/src/linux/.config | grep CONFIG_PRINTER
127   Users and groups:
129    The printer daemon should not run as user root for security reasons.
130    Check, whether you have a user named "lp", that is member of the group
131    "daemon". If you do not, create such user, by running
133   groupadd -g 5 daemon
135   useradd -u 5 -d /var/spool/lp -s /bin/sh -g daemon lp
137   apsfilter
139    In order to build apsfilter, it is necessary, that you have an
140    executable file named "sendmail" in your path. This does not need to
141    be a real mail transfer agent, since apsfilter does not really use it,
142    except for acquiring the apsfilter's author's mail address.
144    You might get along, by creating a faked sendmail, like
146   touch /usr/bin/sendmail &&
147   chmod 750 /usr/bin/sendmail
149    but consider installing a real MTA. If you want an easy solution for a
150    dial-up system, consider Masqmail, which is quite easy to set up. Find
151    Masqmail here: http://www.innominate.org/~oku/masqmail/
153    (please consider, sending the apsfilter's author an email
154    nevertheless).
156 Building gdbm
158    The gdbm database library helps speed up large print jobs.
160    LPRng does not compile unless you have "gdbm" installed. You may
161    choose, not to install it, and to skip this section. In that case, you
162    will have to use "--disable-gdbm" as a "configure" option, when
163    compiling LPRng.
165    For more information see:
166      * http://www.astart.com/lprng/LPRng-HOWTO.html
167      * http://www.gnu.org/software/gdbm/gdbm.html
169    The configure script does not seem to recognize the "--prefix=..."
170    option correctly, so we will manually make an adjustment to the
171    Makefile.
173    Enter:
175 ./configure &&
176 ed Makefile <<EOF
177 /^prefix/s#/local##
181 make &&
182 make install
184 Building LPRng
186    LPRng seems to behave in an unpredictable way, if you use optimization
187    higher than O2. You may try to compile it with your usual compiler
188    flags. But if this fails, try "-O2"
190    Build LPRng with the following commands:
192 ./configure --prefix=/usr \
193   --sysconfdir=/etc \
194   --with-userid=lp \
195   --with-groupid=daemon &&
196 make &&
197 make install
199    Instead of using the start stop script, that comes with LPRng, create
200    such a file from the /etc/init.d/template file.
202 Building Ghostscript
204    Extract the package and change to the top-level-directory of the
205    distribution. If you use version 5.10 you will find all the source
206    files in that directory. Users of version 6.5 and higher will find
207    subdirectories there, containing the sources, libraries etc.
209    If you can not find a file named unix-gcc.mak in your present
210    directory (which should be gs<VERSION>), then copy it there from the
211    src subdirectory.
213    Stay in the same directory and extract the zlib-package. This creates
214    a directory named zlib-1.1.3. Rename this directory to zlib (or make a
215    symlink).
217    Extract jpegsrc.v6b.tar.gz and rename the jpeg-6b directory to jpeg
218    (or make a symlink).
220    Extract libpng-1.2.1.tar.gz and move the libpng-1.2.1-directory to
221    libpng (or - guess, what - make a symlink).
223    Create the file changes.sed, containing the following lines:
224   s|XINCLUDE=-I/usr/local/X/include|XINCLUDE=-I/usr/X11R6/include|
225   s|XLIBDIRS=-L/usr/X11/lib|XLIBDIRS=-L/usr/X11R6/lib|
226   s|jpeg-6a|jpeg|
227   s|prefix = /usr/local|prefix = /usr|
228   w Makefile
230    Now create the Makefile, by running the following command:
232   sed -n -f changes.sed unix-gcc.mak
234    Now, you should be ready to compile the whole thing. Just run:
236   make &&
237   make install
239    If the compilation fails with error messages, containing something
240    about zdevcal.c, then append the line
242   #include <time.h>
244    to the file src/time_.h and try again. (This might have to do with
245    glibc-2.2.... but I am not sure about it).
247    Finally extract the fonts to the /usr/share/ghostscript directory. The
248    directory structure should look somewhat like this:
250   /usr/share/ghostscript
251   /usr/share/ghostscript/gs7.00
252   /usr/share/ghostscript/fonts
254   Notes:
256    If you have zlib and libpng installed, you might choose, to use shared
257    versions of the libpng and zlib libraries. In that case, please edit
258    the Makefile, before running "make":
260    Change SHARE_LIBPNG=0 to SHARE_LIBPNG=1.
262    Change SHARE_ZLIB=0 to SHARE_ZLIB=1.
264    Make sure you have the paths to your X libs and X*.h files accessible
265    to the build process. With a default X install they should be in
266    /usr/X11R6/lib and /usr/X11R6/include/X11.
268    Make sure, that the following two lines to are in your
269    /etc/ld.so.conf:
271 /usr/X11R6/lib
272 /usr/X11R6/include/X11
274    and run
276   ldconfig
278    It is possible, to build ghostscript, without having X installed. In
279    that case, edit the Makefile and comment out all the lines, that refer
280    to X.
282 Building psutils
284    Installing psutils is optional. If you do not install the package, you
285    will get a warning, when you install a2ps. For more information see:
286    http://www.dcs.ed.ac.uk/home/ajcd/psutils/
288    The following command will install psutils. It is configured for paper
289    size a4. If you need another media type, then you need to change the
290    line beginning with PAPER= in the Makefile.
292 cp Makefile.unix Makefile &&
293 ed Makefile <<EOF
294 /^BINDIR/s#/local##
295 /^INCLUDEDIR/s#/local##
296 /^PERL/s#/local##
297 /^MANDIR/s#/local##
301 make &&
302 make install
304 Installing a2ps
306    a2ps is the "Any (graphics format) to Postscript" converter.
308    Compile a2ps by entering:
310 ./configure --prefix=/usr \
311   --sysconfdir=/etc \
312   --enable-shared &&
313 make &&
314 make install
316 Building apsfilter
318    Apsfilter a filter that runs ghostscript and creates /etc/printcap.
320    Compile apsfilter by entering
322 ./configure --prefix=/usr \
323   --sysconfdir=/etc &&
324 make &&
325 make install
327    The last thing, that you have to do is, to configure apsfilter using
328    /usr/share/apsfilter/SETUP
330    You will be asked a series of questions about printer type, which
331    driver to install, paper size, network connection etc.
333 Sources and disclaimer
335    We certainly do not consider ourselves experts at print installations.
336    This document should give you a good start though. We welcome any
337    comments.
339 Contributions
341    02 May 2002. Yoon Soo <yoonsoo@web.de> added:
343    I have an addition which may be interesting for your lfs-hint about
344    printing.
346    It deals with ghostscript-6.51 :
348    If you already have installed zlib and libpng (as described in the
349    blfs book) you can skip the copy of these sources into the ghostscript
350    tree (for jpeg it is strongly recommended to have this statically
351    linked).
353 cp Makefile Makefile.bak
354 sed "60 s/\/usr\/local/\/usr/" Makefile.bak |
355 sed "65 s/\/man/\/share\/man/" |
356 sed "s/SHARE_LIBPNG=0/SHARE_LIBPNG=1/" |
357 sed "s/SHARE_ZLIB=0/SHARE_ZLIB=1/" |
358 sed "263 s/-I/-I\/usr/" > Makefile
359 make
360 make install
362 Further information:
364      * http://www.linuxdoc.org/HOWTO/Printing-HOWTO/index.html
365      * http://www.linuxprinting.org/printer_list.cgi