Let's face it: Unix-Linux (and vice-versa) printing is never easy. There are always many alternatives to choose
from when planning your printing configuration, each with their own advantages and disadvantages. Do you print local, direct-attached or use Samba? How will your Windows clients print? What may be easiest for you, as an administrator, may be cumbersome for an end-user. Given a scenario of a network that requires its own subnet exclusive to your Unix/Linux environment, how do we print from Linux to a printer attached to a Unix server and vice-versa? We'll discuss some challenges and gotchas for tackling that situation here.
LPR on Linux and AIX printing
Our first step will be installing LPR on Linux. If it is currently included in your distribution, we can skip this step. At RPMfind you can find it complete with pre-compiled binaries that are available for most distributions. LPRng, a version of LPR, is an enhanced implementation of the Berkeley LPR print spooler functionality. It provides for the lpr, lpc and lprm programs, along with dynamic redirection of print queues, automatic job holding and highly verbose diagnostics. It also provides emulation packages for the SVR4 lp and lpstat programs; this, in turn, eliminates the need for another print spooler package. If you need the source, you can get it from LPRng Sourceforge page.
For the purposes of this article, we will use IBM's Unix-AIX as an example. First, we have to understand AIX printing. AIX uses a general queueing system, available for any queue-related purpose, including printing. What happens is as follows:
- The user submits the print job to a queue.
- A server called qdaemon monitors those queues and schedules and initiates the jobs.
- qdaemon then sends the job to a back-end program /usr/lpd/piobe (for our remote printing).
- The output of the backend program is then sent to the specified physical device.
To send a print job to a remote printer, the /usr/lpd/rembak back-end program is used. The advantage with AIX lies in that one can print with either lp or lpr, since both are just front ends to the AIX print command enq.
To set this up, follow this process:
- Add local printer (Unix)
- Add local queue (Unix)
- Test local printing (Unix)
- Allow remote clients to print (Unix)
- Add remote printer (Linux)
Adding your AIX printer
First, let's add the local printer. For those of you not familiar with AIX, you either use command line tools or the System Management Interface Tool (SMIT) to set up the printer. As most administrators use SMIT (it is recommended, as it ensures that all the appropriate system files are updated), we'll show this method:
# smit pdp
Where prompted, you will select your printer type and port number. When this is completed, it will add your printer to the configuration database and you should see the following output:
Your next step will be to create a queue. This is also done with SMIT, because you need to go to the AIX print spooling section to add your queue. Here is a snapshot of the SMIT panel for adding the queue:
AIX Print Spooling Move cursor to desired item and press Enter. Start a Print Job Manage Print Jobs List All Print Queues Manage Print Queues Add a Print Queue Add an Additional Printer to an Existing Print Queue Change / Show Print Queue Characteristics Change / Show Printer Connection Characteristics Remove a Print Queue Manage Print Server Programming Tools Change / Show Current Print Subsystem F1=Help F2=Refresh F3=Cancel F8=Image F9=Shell F10=Exit Enter=Do
When completed, F10 to exit out of SMIT:
# lpstat psq lp0 READY
At this time, we can test out our local printer:
lp -dpsq /etc/motd
Before going to Linux, you must also add the host name and IP address of each print client. This can also be done through SMIT:
# smit server Add Print Access for a Remote Client Type or select values in entry fields. Press Enter AFTER making all desired changes. [Entry Fields] * Name of REMOTE CLIENT  (Hostname or dotted decimal address) F1=Help F2=Refresh F3=Cancel F4=List F5=Reset F6=Command F7=Edit F8=Image F9=Shell F10=Exit Enter=Do
When you have completed adding the remote client information, you are now ready to attack Linux.
Adding your Linux printer
Let's assume that you have already installed LPRing. LPRng uses /etc/printcap as the central printing configuration file. To print to your AIX server, the printcap file should have the following lines in them.
lp|psq|your_aix_printer:\ :sd=/var/spool/lpd/psq:\ :rm=your_aix_host:\ :rp=psq:\ :sh:
These lines include your printer queue, the local spool directory on Linux and the host name of the AIX server. After you have finished editing the file (assuming you are not using a GUI front-end), you must restart your lpd daemon. Doing this is as simple as:
# lpd restart
Just make sure your lpd is in your path, or you know where it is. That's really all there is to it. The lpq outpout should show something to this effect:
psq lp0 READY
The steps with other versions of Unix, such as Solaris, are pretty similar. With Solaris 10, you can either use the command line or their GUI, the Solaris Print Manager. With Solaris, I prefer the command line; there are steps outside of the GUI that still need to be performed from the command line when using the GUI to configure locally-attached printers.
The high-level steps to print from Linux to Unix are generally easier, particularly if you are more Linux savvy. First, you would install the local printer using whatever Linux front-end you use, depending your distribution. Here are the steps, using SLES 10 as an example:
- Hardware detection
If an unconfigured local printer is detected when you log in, Yet another Setup Tool (YaST) will start configuring it. To configure the printer, select Hardware > Printer in the YaST control center. This opens a printer configuration window, where all the detected devices are listed in the upper part. If your printer was not detected, you must configure it manually. Let's assume that YaST was able to find the printer during the hardware auto-detection process At this point, no settings would need to be changes from the hardware level.
- Setting up the queue:
This is where you issue the print commands, the concepts are the same as with AIX.
- Choosing your printer model and PPD File:
For many printer models, several PPD files are available if several Ghostscript drivers work with the given model that you are looking to configure. When that is done, you can start testing. Keep in mind that you can also use lpadmin and lpoptions at the command line to configure your printers.
When this is done, you would go back to AIX to install the queue, selecting the remote attachment type. Then, return to your printer. Because the bulk of the work is done on the side where your printer is directly attached to, that's all there is to it, other then testing and troubleshooting.
Interoperability instead of segregated platforms
Don't be afraid to always look for interoperability solutions stead of separating your Unix and Linux systems. Interoperability methods make life simpler, more efficient and reduce. There may be times where it makes much more sense to configure printing using Samba or via an existing network with JetDirect cards.
Unfortunately, we can't always control the way in which we'd like to have things configured. Sometimes, we just need to get it done, regardless of how we would have configured the network from the get-go. That's what make systems administration so much fun.