2 Install & configure local & remote printers Candidates should be able to install a printer daemon, install and configure a print filter (eg apsfilter, magicfilter). This objective includes making local and remote printers accessible for a linux system, including postrscript, non-postscript and samba printers. Install & configure local & remote printers lpd The Printing daemon /var/spool/lpd/* - Spooler directories /etc/printcap - Configuration file /etc/apsfilter/* /var/lib/apsfilter/* /etc/magicfilter/* 1.107.4 Install and configure local and remote printers Weight 1 Linux Professional Institute Certification — 102 Geoff Robertson Nick Urbanik 2005 July – General Linux 2 – Install & configure local & remote printers [2mm] (Linux Professional Institute Certification)[1mm] 1 .~. /V\ // \\ @._.@ Presentation by Andrew Eager geoffrey robertson geoffrey@zip.com.au Printing-HOWTO Printing-Usage-HOWTO www.linuxprinting.org Linux Printing • There are several packages available for linux printing: – LPR – LPRng – Cups • LPR (or LPRng) is the default on most Linux distros • Major components of the LPR subsystem are: – lpd - The printing daemon – lpr - A tool to submit jobs into the queue – lprm - A tool to remove jobs from the queue – lpq - A tool to view jobs in the queue – lpc - An administration tool for printers & queues $Id: gl2.107.4.slides.tex,v 1.2 2003/08/20 14:15:43 geoffr Exp $ %$ Install & configure local & remote printers 1.107.2 Manage printers & print queues 1.107.3 Print files 1.107.4 Install & configure local & remote printers c 2002 Geoffrey Robertson. Permission is granted to make and distribute verbatim copies or modified versions of this document provided that this copyright notice and this permission notice are preserved on all copies under the terms of the GNU General Public License as published by the Free Software Foundation—either version 2 of the License or (at your option) any later version. 1 Copyright 3 Installing a Printer • There are two ways to install a printer under Linux: • The easy way! - Use a GUI like printtool • The hard way: – Edit /etc/printcap – Create the spool directory – Touch the log file – Restart lpd printcap - The configuration file /etc/printcap contains information about all printers on the system (including remote printers) An example looks like: HPLjet|lp|lp0:\ :ml=0:\ :mx=0:\ :sd=/var/spool/lpd/HPLjet:\ :sh:\ :lp=/dev/lp0:\ :lf=/var/spool/lpd/HPLjet/log:\ :if=/usr/share/printconf/util/mf_wrapper: printcap - The configuration file Key points to note about printcap format: • Comments start with a ’#’ • Any line not starting with a colon or pipe is the start of a printer definition • Each line of a definition ends in a backslash except the last line • lpd must be restarted each time /etc/printcap is edited • Spool directory & log file must be created manually printcap - The configuration file if Define the input filter lf Define the printer log file lo Define the lock file created when printer is in use mx Define the maximum size of a print job rm Specify printer is on remote machine. Eg :rm=192.168.222.254: rp Define remote printer name. Eg :rp=HPLjet: sh Tell lpd not to print banner pages sd Specify spool directory Creating spool directory & log file The spool directory should be owned by lp and have permissions set to 700: • # mkdir /var/spool/lpd/HPLjet ← • # chown lp:lp /var/spool/lpd/HPLjet ← • # chmod 0700 /var/spool/lpd/HPLjet ← 4 The log file should have permissions set to 666 and have the same ownership as the spool directory: • # touch /var/spool/lpd/HPLjet/log ← • # chown lp:lp /var/spool/lpd/HPLjet/log ← • # chmod 0660 /var/spool/lpd/HPLjet/log ← Controlling printer access • Printer access is controlled through /etc/hosts.lpd • If the file does not exist, all access is granted • If the file exists, only those in the list will be granted access • The format is: [host [user]] Example: All access from box2.c222, only greg from box3.c222 box2.c222 box3.c222 greg 5 Print Filters • A print filter converts data to be printed into a language that your printer understands • There are several print filter packages: – Apsfilter – Magicfilter – Red Hat’s PrintTool – Foomatic Key Point Summary • Most Linux Systems use LPR (or LPRng) • Local & remote printer configs are stored in /etc/printcap • The print spool directory & log file must be created manually • Print access is controlled using /etc/hosts.lpd • Print filters convert different data types to a language understood by the printer • The lpd daemon is responsible for getting jobs from the user, putting them through the filter and delivering them to the spool directory. Key Point Summary • The lpc program is used to control the printer and print spools • The lpq program is used to view the print queues • The lprm program is used to remove jobs from the queues • The lpr program is used to submit jobs into the queue. License Of This Document Copyright (C) 2005 Nick Urbanik You can redistribute modified or unmodified copies of this document provided that this copyright notice and this permission notice are preserved on all copies under the terms of the GNU General Public License as published by the Free Software Foundation–either version 2 of the License or (at your option) any later version.