               LPRng Installation 
          Patrick Powell <papowell@lprng.com>
          Updated Tue Dec 26 08:38:53 PST 2000

CAVEATS and WARNINGS:

    The LPRng software requires an ANSI C compiler and a make that is
    compatible with Gnu Make (verson 3.73) or BSD 4.3/4.4.  By default,
    LPRng is compiled and tested using GCC and Gnu Make.

    Starting with Release 3.7.1,  it is STRONGLY recommended that you
    install the gdbm database support library.  This will provide a
    significant performance increase.
    If you do not want to install or use the gdbm database use the
     --disable-gdbm configuration option.
    
    GNU Make, GCC, and gdbm are available at many FTP sites, such as:
      ftp://prep.ai.mit.edu/pub/gnu
      ftp://ftp.uu.net/pub/gnu

Solaris Users:
   
     You can get precompiled versions of the GCC compiler, GNU Make,
   and gdbm libraries from:
      www.sunfreeware.com
   
   Use the "install in '/usr/local/'" versions.  The LPRng code has
   NOT been tested with the Sun Microsystems compilers, and NOT been
   tested with 64 bit support enabled.
   
     You MUST repeat MUST set your PATH so that the GNU gcc and
   other utilities in /usr/local/bin are found FIRST and then you
   MUST have the /usr/ccs/bin next in your path.
   
     PATH=/usr/local/bin:/usr/ccs/bin:$PATH
   
   If you have ANY problems with compilation,  and you are NOT
   using a 'clean' GCC installation,  please install GCC from
   a package (see http://www.sunfreeware.com) or recompile gcc
   and reinstall it.  Also,  please make sure that the include
   files are correct for your version of Solaris.  In fact,
   I recommend that you do the compilation on a 'clean' machine
   that has nothing but a 'virgin' Solaris Install + utilities
   BEFORE reporting problems.
   
     You have been warned.
   
HPUX Users:
    See the following site for precompiled GCC and other tools:
         http://hpux.cae.wisc.edu/

   I STRONGLY recommend installing GCC and using GCC,  especially
   on HPUX 9.X and 10.X.  Make sure that your include files are
   the correct ones for your particular OS.
   
   If you use the native or HP provided C compiler,  you will need to
   add some additional flags to allow ANSI C compatibility.  The
   -Aa and -Ae are candidates,  but you will have to check your
   particular compiler for details.
   
     You have been warned.

EXTREMELY IMPORTANT WARNING FOR THE SANITY OF SYSADMINS

	It is extremely dangerous to use NFS mounted file systems for spool
	directories.  The LPRng system depends on file locking for process
	coordination and synchronization.  Given the historical evidence
	of problems with file locks and NFS,  not to mention the terrible
	performance impact,  it is strongly recommended that you use a file
	system local to the server host for your spool directories.

     You have been warned.

EXPRESS INSTALLATION INSTRUCTIONS

  AUTOMATED STARTUP

  The during installation,  the LPRng software will try to
  install a startup script for the following systems:

  FreeBSD:  will stop the LPD print spooler, try to install
   startup script.  If your system is compatible with this,
   see notes on INIT SCRIPTS AND PACKAGES at end of this file.
  BSDI: will stop the lpd server.  You will need to hand
   install an init script.  See INIT SCRIPTS AND PACKAGES
    at end of this file.
  Linux: RedHat - will try to use the chkconfig script to
    set up lprng.
  Solaris: will edit /etc/inetd.conf file,  remove the
    printer entry.   Also puts in startup script in
    /etc/init.d and creates link in /etc/rc2.d for startup.
    See the HOWTO for additional on Solaris installation.
  Other distributions:  you will have to hand install 
    startup scripts.  See the sample startup scripts on your
    system and modify them appropriately.  You will probably
    be able to simply change the path to the lpd program
    or lpsched program to use the LPRng lpd server.

STEP 1: ./configure

  The LPRng default installation puts files
  in the following locations or uses the following paths:

   default installation directories:
     ${prefix}  is usually /usr/local
     ${exec_prefix}  is usually ${prefix}
     ${bindir}  is usually ${exec_refix}/bin, (/usr/local/bin)
     ${sbindir} is usually ${exec_prefix}/sbin (/usr/local/sbin)
     ${libexecdir} is usually ${exec_prefix}/libexec (/usr/local/libexec)
     ${sysconfdir} is usually ${prefix}/etc (/usr/local/etc)
     ${mandir} is usually ${prefix}/man     (/usr/local/man)

     i.e - /usr/local/etc/{lpd.conf, lpd.perms, printcap}

     We install a sample lpd.conf or lpd.perms in
      ${sysconfdir}/lpd.conf.sample, lpd.perms.sample,
    
   We install the executables in: 
         (* indicates default SETUID Root install) 
     ${bindir}/ lpr *, lprm *, lpq *, lpstat *
     ${sbindir}/lpc *, checkpc, lpd *
     ${libexecdir}/filters/ lpf, banner, etc 
     ${sysconfdir}/ lpd.conf, lpd.perms, printcap
     ${mandir}/ man pages

     i.e. - /usr/local/bin/{lpr, lprm, ... }
            /usr/local/sbin/{lpd, checkpc, lpc ... }
            /usr/local/libexec/filters/{lpf, banner, etc }

OR STEP1: ./configure --prefix=/usr --sysconfdir=/etc

  By convention,  many systems use /etc, /usr/bin, and /usr/sbin for the
  locations of these files.  Note that the location of the lpd server differs
  radically from system to sytem.
     
   Suppose you wanted to install in /usr/bin, /usr/sbin, and /etc:
     configure --prefix=/usr --sysconfdir=/etc
     
OR STEP1: Custom Installation - see LPRng-HOWTO

  In addition to the --prefix, etc., mentioned above,  there are several
  more you can use:

  --with-cc=COMPILER      select compiler to use
  --with-ccopts=CFLAGS    select compiler command line options
  --with-linker=LINKER    select linker to use
  --with-ldopts=LDFLAGS    select linker command line options
  --with-cppopts=CPPFLAGS  select compiler preprocessor command line options
  --disable-setuid                  disable setuid root client and server executables
  --disable-gdbm                    disable the use of the GDBM library support
  --enable-priv_ports               require connections to be from privileged ports
  --disable-force_localhost         force_localhost default to disabled
  --disable-require_configfiles     client programs require lpd.conf, printcap
  --enable-kerberos                 enable kerberos support
  --enable-mit_kerberos4            enable MIT Kerberos 4 support
  --disable-kerberos_checks         disable kerberos library location and checking for support
  --with-lpddir=DIR                 lpd executable directory (default ${sbindir})
  --with-lpd_conf_path=PATH         path of lpd.conf (default: ${sysconfdir}/lpd.conf)
  --with-lpd_perms_path=PATH        path of lpd.perms (default: ${sysconfdir}/lpd.perms)
  --with-printcap_path=PATH         path of printcap (default ${sysconfdir}/printcap)
  --with-lpd_printcap_path=PATH     path of lpd_printcap (default ${sysconfdir}/lpd_printcap)
  --with-lockfile=PATH              lockfile PATH, default /var/run/lpd 
  --with-ld_libary_path=PATH        LD_LIBRARY_PATH value 
  --with-filter_path=PATH           filter PATH value 
  --with-userid=NAME                run LPRng software as this userid, default daemon 
  --with-groupid=NAME               run LPRng software as this groupid, default daemon 
  --with-chooser_routine=NAME       load balance queue chooser routine name in user object file 
  --with-order_routine=NAME         queue order routine name in user object file 
  --with-user_objs=NAME             user specified object file 
  --with-user_include=NAME          include file with function prototypes for user object file 
  --with-filterdir=DIR              filter directory (default ${libexecdir}/filters)
  --disable-strip                   disable stripping binaries by default

STEP2: Make and Install
    make clean all;
    su   # you must do the following commands as root
    make install
    ./src/checkpc -f

STEP3: Manually Start Server and Check
    If the installation step did not install the system time
    run scripts or you need to do the installation by hand,
    here is the method to follow:

    # kill off the old server
    On BSD:
    kill `ps -aux |grep lpd | awk '{print $2}'`
    On System V:
    kill `ps -e |grep lpd | awk '{print $1}'`

    # you should remove or rename the existing lpd binaries if they
    # have not been installed correctly:
    mv /usr/lib/lpd /usr/lib/lpd.old
    ln -s /usr/local/bin/lpd /usr/lib/lpd
    # you might want to track down the old lpr, lpq, lprm binaries
    find /usr -type file -name lp\*  -print >/tmp/candidates
    find /sbin -type file -name lp\* -print >>/tmp/candidates
    # Examine the /tmp/candidates file, and remove or rename the
    # non-LPRng versions of the programs
    # remove or rename the candidate files
    /usr/local/sbin/lpd;    # start up LPD
      OR
    /usr/sbin/lpd;    # start up LPD
      OR
    /????/lpd         # start up LPD
    lpq;    # test it with LPQ

If you are running on Solaris, see the Solaris section in the
LPRng-HOWTO for further instructions on integration with the LP subsystem.

STEP4: Fix automatic startup

BSD (/etc/rc) based systems.
Don't forget to modify the /etc/rc.local or other system startup files
to start LPRng's lpd.  You can find the file by looking for the 'lpd'
line in the startup files.

LINUX, System V, Solaris:

There is a print services startup file in /etc/rc.d/init.d.

For UNIX SystemV or Linux like systems,  here is
a small sample file that will start up and shut down the lpd server.
This is simply a copy of the /etc/rc.d/lpr file.  Copy the existing file
before you edit or remove it.


#!/bin/sh
case "$1" in
  start)
        # Start daemons.
        /usr/bin/echo "Starting lpd: \c"; /usr/local/bin/lpd; /usr/bin/echo;
        ;;
  stop)
        # Stop daemons.
        /usr/bin/echo "Shutting down lpd: \c"
        server=`/usr/local/bin/lpc -Pany@localhost lpd \
        | awk '{for(i=1;i<=NF;++i){v=$i+0;if(v>1){ print v;exit;}}}'`
        if [ -n "$server" ]; then
            /usr/bin/echo " server pid $server";
            kill $server;
        else
            /usr/bin/echo " no server active";
        fi;
        ;;
  *)
        echo "Usage: lpd {start|stop}"
        exit 1
        ;;
esac

PRINTCAP FILES:

You will probably want to update your printcap files.  See
the LPRng-HOWTO for information on printcap files.
If you want to use existing or non-LPRng compatible filters,
try setting the :bkf:  (Berkeley LPD conformant filter) in the
printcap entry:

Example:

lp:bkf:\
  :if=/usr/local/libexec/very.old.filter

KERBEROS IV:
   If you want to use Kerberos 4,  see the comments in the src/Makefile
and follow the indicated directions.

                      CONFIGURE DETAILS

The configure script attempts to generate Makefiles which should compile
and build on your system.

./configure --help
Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
Configuration:
  --cache-file=FILE       cache test results in FILE
  --help                  print this message
  --no-create             do not create output files
  --quiet, --silent       do not print `checking...' messages
  --version               print the version of autoconf that created configure
Directory and file names:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [same as prefix]
  --bindir=DIR            user executables in DIR [EPREFIX/bin]
  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
  --datadir=DIR           read-only architecture-independent data in DIR
                          [PREFIX/share]
  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
                          [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
  --includedir=DIR        C header files in DIR [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
  --infodir=DIR           info documentation in DIR [PREFIX/info]
  --mandir=DIR            man documentation in DIR [PREFIX/man]
  --srcdir=DIR            find the sources in DIR [configure dir or ..]
  --program-prefix=PREFIX prepend PREFIX to installed program names
  --program-suffix=SUFFIX append SUFFIX to installed program names
  --program-transform-name=PROGRAM
                          run sed PROGRAM on installed program names
Host type:
  --build=BUILD           configure for building on BUILD [BUILD=HOST]
  --host=HOST             configure for HOST [guessed]
  --target=TARGET         configure for TARGET [TARGET=HOST]
Features and packages:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --x-includes=DIR        X include files are in DIR
  --x-libraries=DIR       X library files are in DIR
--enable and --with options recognized:
  --with-cc=COMPILER      select compiler to use
  --with-ccopts=CFLAGS    select compiler command line options
  --with-linker=LINKER    select linker to use
  --with-ldopts=LDFLAGS    select linker command line options
  --with-cppopts=CPPFLAGS  select compiler preprocessor command line options
  --disable-setuid        disable setuid root client and server executables
  --enable-priv_ports     require connections to be from privileged ports
  --disable-force_localhost force_localhost default to disabled
  --with-lpddir=DIR       lpd executable directory (default ${sbindir})
  --with-filterdir=DIR     filter directory (default ${libexecdir}/filters)
  --with-lpd_conf_path=PATH     path to lpd.conf (default: ${sysconfdir}/lpd.conf)
  --with-lpd_perms_path=PATH    path to lpd.perms (default: ${sysconfdir}/lpd.perms)
  --with-printcap_path=PATH     path to printcap (default ${sysconfdir}/printcap)

  --enable-nls           use Native Language Support
  --with-included-gettext use the GNU gettext library included here
  --with-catgets          use catgets functions if available

   The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation.  It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions.  Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').

   If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release.  If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.

   The file `configure.in' is used to create `configure' by a program
called `autoconf'.  You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.

The simplest way to compile this package is:

  1. In the same directory as these instructions, execute
     `./configure' to configure the package for your system.  If you're
     using `csh' on an old version of System V, you might need to type
     `sh ./configure' instead to prevent `csh' from trying to execute
     `configure' itself.

     Running `configure' takes awhile.  While running, it prints some
     messages telling which features it is checking for.

  2. Type `make' to compile the package.  This will create the executables
     in the source directory.

  3. Type `make install' to install the programs and any data files and
     documentation.

  4. You can remove the program binaries and object files from the
     source directory by typing `make clean'.  To also remove the files
     that `configure' created (so you can compile the package for a
     different kind of computer), type `make distclean'.

Compilers and Options
=====================

   Some systems require unusual options for compilation or linking that
the `configure' script does not know about.  You can give `configure'
initial values for variables by setting them in the environment.  Using
a Bourne-compatible shell, you can do that on the command line like
this:
     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure

Or on systems that have the `env' program, you can do it like this:
     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure

If you wish to generate Makefiles with these options built in, use:
  ./configure
  --with-cc=COMPILER     # select compiler to use
  --with-ccopts=CFLAGS   # select compiler command line options
  --with-linker=LINKER   # select linker to use
  --with-ldopts=LDFLAGS  #  select linker command line options
  --with-cppopts=CPPFLAGS # select compiler preprocessor command line options
  --with-lpddir=DIR      # where to install the lpd binary.  default: $(bindir)
  --with-admindir=DIR    # where to install the administrative commands

Example: 
   ./configure "--with-cppopts=-I/usr/local/include -I/usr/include/krb5"
      "--with-ldopts=-L/usr/local/lib" --with-lpddir=/usr/libexec

Using a Different Build Directory
=================================

   You can compile the package in a different directory from the one
containing the source code.  Doing so allows you to compile it on more
than one kind of computer at the same time.  To do this, you must use a
version of `make' that supports the `VPATH' variable, such as GNU
`make'.  `cd' to the directory where you want the object files and
executables to go and run the `configure' script.  `configure'
automatically checks for the source code in the directory that
`configure' is in and in `..'.

Installation Names
==================

   By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc.  You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.

   You can specify separate installation prefixes for
architecture-specific files and architecture-independent files.  If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.

   If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.

Optional Features
=================

   Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System).  The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.

   For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.

Specifying the System Type
==========================

   There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on.  Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option.  TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
     CPU-COMPANY-SYSTEM

See the file `config.sub' for the possible values of each field.  If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.

   If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.

Sharing Defaults
================

   If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists.  Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.

Operation Controls
==================

   `configure' recognizes the following options to control how it
operates.

`--cache-file=FILE'
     Save the results of the tests in FILE instead of `config.cache'.
     Set FILE to `/dev/null' to disable caching, for debugging
     `configure'.

`--help'
     Print a summary of the options to `configure', and exit.

`--quiet'
`--silent'
`-q'
     Do not print messages saying which checks are being made.

`--srcdir=DIR'
     Look for the package's source code in directory DIR.  Usually
     `configure' can determine that directory automatically.

`--version'
     Print the version of Autoconf used to generate the `configure'
     script, and exit.

`configure' also accepts some other, not widely useful, options.

SECURITY WARNINGS

  The default configuration for LPRng allows connections from
  any port, while a strict RFC1179 implementation would require
  connections only from a port in the range 721-731.  Relaxing
  this restriction allows non-setuid root clients (lpr, lpq, etc)
  to connect to the LPRng server.

  The following is the default LPRng system installation:

    1. All client programs are installed Setuid Root
    2. No checking is done for strict RFC1179 conformance by clients
       or the lpr server
    3. By default, all client programs will connect to the server
       on the local host (force_localhost configuration option).

  This configuration allows you to connect directly to non-LPRng systems
  using the LPRng clients,  and to have the maximum flexibility with the
  least amount of system configuration problems.  You can modify the
  /etc/printcap file, and set 'force_localhost@' for printers whosse
  spool queues are not on the localhost,  and which require connections
  to originate from a privileged port.

  This configuration is the most common one encountered by system
  administrators,  but has the drawback of having SETUID clients.

  A more cautious approch is to use the following:

    1. No LPRng programs are installed Setuid Root
       (configure --disable-setuid)
    2. All clients communicate directly to the server on the localhost.
    3. The server is started are system initialization time by root.

  If you insist on strict RFC1179 conformance for remote connections
  to your server:
    1. All client programs are installed Setuid Root
    2. All connections must originate from a privileged port
       (configure --enable-priv_ports)

  Finally you are truly paranoid,  then you should read the LPRng HOWTO
  section on Authentication,  and add either PGP or Kerberos authentication
  to your system,  and do not install the LPRng clients Setuid ROOT.

NON-SETUID Install

  If you want to install LPRng without setuid permissions,  then you must
  use the following:
      ./configure --disable-setuid ...
      make all install

      vi /.../etc/lpd.perms
