267 lines
12 KiB
HTML
267 lines
12 KiB
HTML
<!--startcut ==============================================-->
|
|
<!-- *** BEGIN HTML header *** -->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML><HEAD>
|
|
<title>The CUPS printing system LG #90</title>
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
|
|
ALINK="#FF0000">
|
|
<!-- *** END HTML header *** -->
|
|
|
|
<!-- *** BEGIN navbar *** -->
|
|
<A HREF="raghu.html"><< Prev</A> | <A HREF="index.html">TOC</A> | <A HREF="../index.html">Front Page</A> | <A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue90/ward.html">Talkback</A> | <A HREF="../faq/index.html">FAQ</A> | <A HREF="weber.html">Next >></A>
|
|
<!-- *** END navbar *** -->
|
|
|
|
<!--endcut ============================================================-->
|
|
|
|
<TABLE BORDER><TR><TD WIDTH="200">
|
|
<A HREF="http://www.linuxgazette.com/">
|
|
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
|
|
WIDTH="200" HEIGHT="41" border="0"></A>
|
|
<BR CLEAR="all">
|
|
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
|
|
</TD><TD WIDTH="380">
|
|
|
|
|
|
<CENTER>
|
|
<BIG><BIG><STRONG><FONT COLOR="maroon">The CUPS printing system</FONT></STRONG></BIG></BIG>
|
|
<BR>
|
|
<STRONG>By <A HREF="../authors/ward.html">Alan Ward</A></STRONG>
|
|
</CENTER>
|
|
|
|
</TD></TR>
|
|
</TABLE>
|
|
<P>
|
|
|
|
<!-- END header -->
|
|
|
|
|
|
|
|
<p>The CUPS printing system is what its name says: a Common Unix Printing
|
|
System. It is aimed at providing a common printing interface across a local
|
|
network, masking differences between the printing system on each computer.
|
|
While I am not sure that such a system is really needed in a
|
|
purely Linux environment where the standard Berkely LPD provides this functionality,
|
|
CUPS does provide interactivity with SMB and Windows printers. CUPS also
|
|
allows dynamic printer detection and grouping.</p>
|
|
|
|
<p>CUPS is licenced under GPL by a company called Easy Software Products.
|
|
Besides providing CUPS itself as free software, it also provides commercial
|
|
addons and support.</p>
|
|
|
|
<p>You can get it from <a href="http:/www.cups.org">www.cups.org</a>, or as
|
|
a RPM package for most distributions (seen it for Mandrake, RedHat and SuSE).</p>
|
|
|
|
<p><b>How does it work?</b></p>
|
|
|
|
<p>CUPS can be seen as a replacement of the LPD printing system. It
|
|
replaces the lpr command with its own, and the LPD printer drivers
|
|
with its own versions. However, it is very similar to LPD in that it is based on
|
|
PostScript as its underlying language for page description. Linux
|
|
(and Unix) programs won't know the difference between CUPS and LPD.</p>
|
|
|
|
<p>It contains a list of printer drivers that include most printers with
|
|
parallel port, USB and even serial connections. Note serial - connecting
|
|
a printer with a null-modem serial line is slow and more difficult to
|
|
set up than a parallel line, but it is sufficient for a matrix printer
|
|
-- for bulk printing or multiple copies -- and makes an easy way to build
|
|
a print server from a pile of older hardware. A hint to schools!</p>
|
|
|
|
<p><b>Dynamic printer detection</b></p>
|
|
|
|
<p>CUPS has a characteristic of Windows systems that is not very common in
|
|
the Unix world: it broadcasts the printers available on the local
|
|
computer to all other computers on the network. In this way, every computer
|
|
on the local IP segment gets to know in real time which printers are
|
|
available and what their status is.</p>
|
|
|
|
<p>Naturally, this is -- unlike Windows :-) -- configurable. You can tell
|
|
CUPS (in the <i>cupsd.conf</i> configuration file) if and where to broadcast
|
|
to, and specify how often the information is refreshed.</p>
|
|
|
|
<p><b>Grouping printers</b></p>
|
|
|
|
<p>A printer group -- called a <b>class</b> by CUPS -- is a group of
|
|
printers that appears as a single printer to user programs. For example,
|
|
you could create a group called ColorPrinters, including all your color
|
|
printers. The user could then tell his program to print on printer ColorPrinters,
|
|
and the output would be on one of these printers. Which one would depend on
|
|
user rights or which printer is currently available.</p>
|
|
|
|
<p>The fact that a printer is a member of a group does not mean, in itself, that
|
|
users cannot use that printer directly. However at CUPS access control level,
|
|
you can make the printers reject jobs - while groups accept them. The
|
|
end result is that users can use printer groups, not printers. It depends a
|
|
bit on the policy on printer use you intend to implement.</p>
|
|
|
|
|
|
<H4>Example 1</H4>
|
|
|
|
<p>I have a workshop with five computers under Linux, all running CUPS.
|
|
When changing a printer on one of them, I:</p>
|
|
|
|
<ul><li>take the old printer off CUPS,</li>
|
|
<li>put in the new printer,</li></ul>
|
|
|
|
<p>through the CUPS web interface in under 30 secs. That is <b>all</b>
|
|
the configuration required - the other computers get their default printing
|
|
routes updated in another 30 secs. Under 1 minute for the whole change: less
|
|
time than a laser printer takes to warm up.</p>
|
|
|
|
|
|
<H4>Example 2</H4>
|
|
|
|
<p>I like to provide, in my school network:</p>
|
|
|
|
<ul><li>A laser B/W printer class, that anybody can print on.</li>
|
|
<li>A draft Color class, that anybody can print on - but with restrictions on volume.</li>
|
|
<li>A precision Color class, that is only unblocked under my supervision.</li></ul>
|
|
|
|
<p>Most of these printers hang off Windows boxes and would be directly
|
|
available for other computers under Windows. However, by providing them
|
|
through CUPS on a central bridge/router, I:</p>
|
|
|
|
<ul><li>provide a means of centralizing printers - users only have to look
|
|
for a printer in a single place;</li>
|
|
<li>provide a means of printing on another ethernet segment, <b>without</b>
|
|
allowing normal Windows broadcast traffic to get across and
|
|
clutter up network bandwidth;</li>
|
|
<li>make sure that the teacher printing from his classroom up there on
|
|
the third floor of the other building doesn't get stuck because the
|
|
departamental printer on the ground floor of this building has run
|
|
out of paper - his print job got redirected to the standby printer.</li></ul>
|
|
|
|
|
|
<p><b>Integrating with Windows</b></p>
|
|
|
|
<p>To use a Windows printer under Linux or the other way round, you will
|
|
need to have a Samba server working. Set this up and test it before
|
|
going on (as a normal user, try viewing your home directory on the Linux
|
|
computer from a Windows box). Remember to turn password encyptation on
|
|
in <i>/etc/samba/smb.conf</i> if you are using Windows 98 or a more recent
|
|
version.</p>
|
|
|
|
<p>CUPS can use printers shared from computers under Windows, and network
|
|
printers using the SMB protocol. You configure a "Windows printer using
|
|
Samba". Basically, all you have to tell CUPS is the address of the printer,
|
|
as in: <i>smb://server/printer</i>.</p>
|
|
|
|
<p>Windows can use a CUPS printer shared by Samba. Proceed in the normal
|
|
way to share your printers with Samba: i.e. do not do anything. Your
|
|
printers are generally shared by defect. If this is not the case, edit
|
|
<i>smb.conf</i> to create the necessary share. All the Samba share options
|
|
are appliable. This is because Samba treats a CUPS printer in the same way
|
|
as a LPD printer.</p>
|
|
|
|
<p><b>Network printers</b></p>
|
|
|
|
<p>Network printers -- i.e. a printer with a network interface, that doesn't
|
|
need a host computer to be made available to the network -- can use
|
|
any of a variety of protocols:</p>
|
|
|
|
<ul><li>SMB protocol - you can see it in your Windows network environment
|
|
browsing screen.</li>
|
|
<li>LPD protocol - several models of Epson printers integrate a TPC/IP
|
|
stack and the LPD protocol. You can then access them on port 515 just
|
|
like a Linux box. Try using default queue <i>lp</i></li>
|
|
<li>A proprietary protocol (not good!).</li></ul>
|
|
|
|
<p>In the first two cases, proceed as with a printer hosted by a computer.
|
|
In the third, you are probably at a dead end. This happened to me with
|
|
a Lexmark: I ended up sharing it from a Windows box.</p>
|
|
|
|
<p><b>Configuration</b></p>
|
|
|
|
<p>There are two ways of configurating CUPS. One is editing the configuration
|
|
file <i>/etc/cups/cupsd.conf</i>. The other is a classical web-based interface
|
|
you can access at port 631. This is very similar to the web-based configuration
|
|
of many network-capable printers, and should be intuitive for all.</p>
|
|
|
|
<p align=center><img src="misc/ward/initial_screen.jpg"></p>
|
|
|
|
<p>Generally, you can access the web interface only from the localhost interface,
|
|
not from other computers. However, you can change this by changing the following
|
|
lines in the configuration file <i>cupsd.conf</i>, and restarting CUPS:</p>
|
|
|
|
<pre>
|
|
<Location /> # this location is the main screen
|
|
Order Deny, Allow
|
|
Deny From All
|
|
Allow From 127.0.0.1 # allow configuration from local host
|
|
Allow From 192.168.1.* # allow configuration from any machine
|
|
# on the 192.168.1.0/24 subnet
|
|
Allow From mybox.mydomain # this is my desktop on another segment
|
|
</Location>
|
|
</pre>
|
|
|
|
<p>You can also specify one by one which menu items (called <i>Locations</i> in
|
|
CUPS terms) are accessible from any particular IP address. This doesn't mean
|
|
that other computers will not be able to connect to the server - just that
|
|
they won't be able to access contents.</p>
|
|
|
|
<p>If your Linux box is acting both as a print server and a bridge between
|
|
two or more IP segments, you can also specify on which network interfaces it
|
|
will listen for requests:</p>
|
|
|
|
<pre>
|
|
Listen 127.0.0.1:631 # Should already be there
|
|
Listen servename:631 # Add your server name here
|
|
Listen 192.168.1.1:631 # You can also use your IP address
|
|
</pre>
|
|
|
|
<p>In the above example, the web interface will be visible through my eth0 interface
|
|
with IP address 192.168.1.1, but not through the eth1 interface with IP
|
|
address 172.16.0.1 .</p>
|
|
|
|
<p>Though user identification is required through basic login/password authentication,
|
|
note that you can use SSL to connect to the web interface through
|
|
the https secure protocol. This is also relatively easy to configure in
|
|
the <i>cupsd.conf</i> file.</p>
|
|
|
|
<p align=center><img src="misc/ward/help_screen.jpg"></p>
|
|
|
|
<p>The web interface has a comprehensive help system with plenty of documentation
|
|
about what CUPS is and how to configure it.</p>
|
|
|
|
|
|
<p>PS. Should anybody want to translate this article: I wrote it in
|
|
the spirit of the GPL software licence. i.e. you are free (and
|
|
indeed encouraged) to copy, post and translate it -- but please,
|
|
PLEASE, send me notice by email! I like to keep track of translations --
|
|
it's good for the curriculum :-)</p>
|
|
|
|
|
|
<!-- *** BEGIN author bio *** -->
|
|
<P>
|
|
<P>
|
|
<!-- *** BEGIN bio *** -->
|
|
<P>
|
|
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png">
|
|
<em>
|
|
Alan teaches CS in Andorra at high-school and university levels. His hobbies
|
|
include science photography (both digital and traditional), trekking, rock and
|
|
processor collecting.
|
|
</em>
|
|
<br CLEAR="all">
|
|
<!-- *** END bio *** -->
|
|
|
|
<!-- *** END author bio *** -->
|
|
|
|
|
|
<!-- *** BEGIN copyright *** -->
|
|
<hr>
|
|
<CENTER><SMALL><STRONG>
|
|
Copyright © 2003, Alan Ward.
|
|
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
|
Published in Issue 90 of <i>Linux Gazette</i>, May 2003
|
|
</STRONG></SMALL></CENTER>
|
|
<!-- *** END copyright *** -->
|
|
<HR>
|
|
|
|
<!--startcut ==========================================================-->
|
|
<!-- *** BEGIN navbar *** -->
|
|
<A HREF="raghu.html"><< Prev</A> | <A HREF="index.html">TOC</A> | <A HREF="../index.html">Front Page</A> | <A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue90/ward.html">Talkback</A> | <A HREF="../faq/index.html">FAQ</A> | <A HREF="weber.html">Next >></A>
|
|
<!-- *** END navbar *** -->
|
|
</BODY></HTML>
|
|
<!--endcut ============================================================-->
|