|In my new office, most of the workstations are NT/2000 boxes on a separate LAN (called CH2M), while there are a few development machines on a separate LAN (called OSE). The two networks can talk to each other via the host Matrix (Linux 2.4.18-14), which also has Samba (2.2.5) installed on it.
There is a network printer (LaserJet 4050 TN), among others, available for printing.
I wasn't sure how good (or bad), the queue managing aspects of the printer were, and besides, I wanted to be able to view the jobs in the queue, pause and/or cancel them, if necessary.
Since Matrix was the gateway and also used as a server for other purposes (it has Oracle 9i and other such stuff), I decided to configure printing on it. Quick search on google revealed CUPS (www.cups.org) as the most-used and robust choice.
So I downloaded CUPS (version 1.1.22), and installed it. Below are the steps I followed:
(make sure you have the following libraries installed before you start)
Installation is quick and easy:
This installs the libraries at /usr/local/libs. The cupsd daemon is installed in /usr/sbin, while the startup script is installed in /etc/init.d/cups and the as usual, the config files go in /etc/cups
1. Edit /etc/cups/cupsd using your favourite editor.
Servername - This is the name as advertised to the world. Clients of your CUPS server will see this name. In my case, it is set to:
AccessLog - This is the location of the CUPS access log (alike Apache). I didn't change it.
LogLevel : controls the number of messages logged to the ErrorLog file and can be one of the following:
(Since I wanted to debug my CUPS setup, I changed the LogLevel to debug. Default is info).
Ports/addresses. The default port 631 is reserved for the Internet Printing Protocol (IPP) and is what we use here. You can have multiple Port/Listen lines to listen to more than one port or address, or to restrict access:
NOTE: In order for the command-line and web interfaces to work, you must have at least one Port or Listen line that allows access from the local loopback address (localhost).
Scroll down now to the "<Location />" section. Alike Apache's httpd.conf, we need to specify connections from which network/subnet/IP can be made. I changed mine to allow connections from my local network:
Finally, onto managing administration access. You may not want to configure/manage CUPS remotely, but from within the network, hence:
That's it. That's all we need to configure for now. Save the file and exit from your editor.
The next step is to add the printer to CUPS. Before you can add a printer to CUPS, you need to get the PPD file for your printer. The one-stop resource for Linux printing is www.linuxprinting.org. Check the printer listing page to see if your printer is listed (http://www.linuxprinting.org/printer_list.cgi). Mine is HP LaserJet 4050 TN. Following is what I was suggested:
So then, I don't really need to download the manufacturer-supplied PPD according to CUPS. So, I'm just going to use the web-interface to add a printer. Alternatively, I could also use the command line. We'll explore both options :-)
As usual, web-interfaces are easy. CUPS web-interface is located at: http://localhost:631. It asks for a username/password. Enter "root" (without the quotes of course), and your root password (alternatively, you can modify cupsd.conf to enable more users to manage CUPS).
That's it. That's all you have to do to setup your printer through the web-interface.
Via, the command line, the CUPS command to use is lpadmin:
You can add a network printer enable the printer with:
Another example for a LPD print server:
To add information about the Location and a Description of the printer:
To specify a PPD for the printer:
The PPD file is copied into /etc/cups/ppd/lp11.ppd, for example.
Lets now start cups.
Starting up cups is a simple matter:
Now that cups is started, let have a look at the logs to see what's happening:
So, no apparent problems there. Let's now use the web-interface to print a test page. Voila, it works!
Ok, I wish it was that easy. You'd probably get the following in your logs:
So, the culprit is ESP GhostScript fails to find the initialization file. This is one of the several install problems that exist in CUPS, and the install guide (according to me), is not clear enough. So, to get rid of this, you first need to have, yes you guessed it correctly! ESP GhostScript.
Download ESP GhostScript from http://www.cups.org/ghostscript.php.
So as you'd imagine, this is ghostscript customized/tweaked (I don't know the details) for CUPS.
IMPORTANT: Make sure you delete your old version of GhostScript, if any. I've found it causes numerous headaches.
GhostScript installation is easy (if you have the dependencies installed already), just follow the install steps.
Re-start CUPS once you have installed GhostScript, and you should have more success this time around.
Now that the printer has been configured and found working, we can proceed to adding the clients. There are two ways you can do that:
1. Manual - You can make your cups server listen for remote lpd connects by adding
to your inetd.conf
You then have to set up entries in /etc/printcap on the machines you want
to use the CUPS server. Annoying if it is lots of machines and/or lots of
2. Let CUPS do it for you
You don't need to set up any printers on the client machines and any changes/new printers on the main CUPS server will automagically appear in the client printcap.
GENERAL PROBLEMS FACED:
1. Print jobs are aborted immediately
2. Ghostscript can't find initialization file gs_init.ps
In my experience, all problems were related to either the printed not being configured properly, or GhostScript not being installed. Any problems, feel free to email me at manavg<at>gmail.com