CUPS… Ain’t no cup -o- Joe…


Ok… So I work in an environment that requires printing from the UNIX/Linux hosts I manage… Printing sucks… plain and simple.  Anyway… We are moving a customer from a SCO box to a new RHEL 5 platform so off I go into the testing phase for printing.  CUPS being my obvious choice, I will just give you the quick-n-dirty version here as I spent WAY too much time looking @ this, but too late now.

So lets say you are starting from the very beginning, like I was with a raw build.  First things first… get CUPS (LOL):

yum -y install cups cups-devel (I grabbed the devel just for the heck-of-it, you may not need it)

This will give you (As of 4-8-2010):

cups-1.3.7-11.el5_4.6
cups-libs-1.3.7-11.el5_4.6
cups-devel-1.3.7-11.el5_4.6

Make sure it is “ON”:

chkconfig –list cups
cups            0:off   1:off   2:on    3:on    4:on    5:on    6:off

Now for the actual setup…  This got a bit out of whack for me but I only say that to embarrass myself ?

We will be working from the /etc/cups directory here so navigate over there if you will please… 🙂  Not too much in here but a few files to config, the main file being cupsd.conf so lets open that one up and make something work shall we?

-rw——- 1 root lp      0 Mar  6 18:19 classes.conf
-rw-r–r– 1 root lp      0 Mar  6 18:19 client.conf
-rw-r–r– 1 root lp    141 Mar 10 13:00 client.conf.rpmsave
-rw-r—– 1 root lp   2704 Apr  8 11:28 cupsd.conf
-rw-r—– 1 root lp   2578 Mar  6 18:19 cupsd.conf.default
drwxr-xr-x 2 root root 4096 Mar  6 18:19 interfaces
-rw-r–r– 1 root root 4533 Mar  6 18:19 mime.convs
-rw-r–r– 1 root root 6298 Mar  6 18:19 mime.types
-rw-r–r– 1 root lp    215 Mar  6 18:19 pdftops.conf
drwxr-xr-x 2 root lp   4096 Apr  8 11:38 ppd
-rw——- 1 root lp    351 Apr  8 11:38 printers.conf
-rw——- 1 root lp      0 Mar  6 18:19 printers.conf.O
-rw-r–r– 1 root root  947 Mar  6 18:19 pstoraster.convs
-rw-r–r– 1 root lp    186 Mar  6 18:19 snmp.conf
drwx—— 2 root lp   4096 Apr  8 11:35 ssl

So there is the expected amount of jargon in here but we need to get the web interface working… Oh I should say that in fact some of what I am going to outline here is not necessary if you have an X Window running on the localhost (with a browser obviously).  I don’t have that in these installations so I need remote access to the CUPS web interface… I guess you could setup a VNC server as well and use that to the localhost, but that seems a bit to effort-full as I don’t need the VNC for anything else.  Anyway, open the file with your editor of choice and lets tweak a few things.  Most of this is @ the very top of the file so that is pretty reasonable.  For some reason this interface is REALLY finicky… so put this in correctly or you will be banging your head on the desk for a while…

# Only listen for connections from the local machine.
Listen localhost:631  <– This is the default, comes already written
Listen 192.168.11.25:631 <– I added this one…
Listen 192.168.11.25:80 <– and this one for remote access as I stated above. This is the server IP… That may not be as obvious as you think…
#Port 631 <– These can work also, but allow anything from anywhere, never a good idea
#Port 80
Listen /var/run/cups/cups.sock <– This is also a default, leave it alone

Go a few lines down…

# Default authentication type, when authentication is required…
DefaultAuthType Basic

# Restrict access to the server…
<Location />
Order allow,deny
Allow localhost <– Added
Allow @LOCAL <– Added
</Location>

# Restrict access to the admin pages…
<Location /admin>
#  Encryption Required <– this will force you to use HTTPS… not a bad idea, it is enabled by default
Order allow,deny
Allow localhost <– Added
Allow @LOCAL <– Added
</Location>

# Restrict access to configuration files…
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow localhost <– Added
Allow @LOCAL <– Added
</Location>

Basically, that’s it.  How the hell that took me more than 5 minutes to do is beyond me, but now it is guaranteed to take you only 5 minutes :).  I will also mention that I added a line in my firewall to allow port 631; I already allowed 80.

At this point you can browse to the CUPS web interface and start adding/managing your printers 🙂

https://<your-server-IP&gt;:631

The rest really is pretty self explanatory.  Happy printing 🙂

Advertisements

, , , , , , , , , , ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: