Even if you don't have a printer on your local machine, you can still
use lpd to send a print job across the network to a printer that is
attached to some other machine. On the client machine, you can add an
entry to your /etc/printcap that looks like a local printer but actually
routes print jobs to the server machine. This entry will look something
like this:
farawaylp|Remote printer entry:\
:rm=faraway:\
:rp=lp:\
:sd=/var/spool/lpd/farawaylp:\
:mx#0:\
:sh:
Here the name of the machine where we want to print is faraway,
and the name of the printer on that machine is lp. The
spool directory, /var/spool/lpd/farawaylp, is where print jobs will be
held locally until they can be sent to the remote print spooler, where
they may be spooled again before being sent to the printer. Again, you
will need to create this spool directory and set its permissions:
# mkdir -p /var/spool/lpd/farawaylp
# chown lp /var/spool/lpd/farawaylp
# chmod 700 /var/spool/lpd/farawaylp
# checkpc -f
# /etc/init.d/lprng restart
Locally, we have given this remote printer the name farawaylp,
so we can send print jobs to it thusly:
$ lpr -Pfarawaylp sample.txt