Using CUPS Print Server for Solaris 10
By Danx-Oracle on Nov 26, 2006
Life is too short for bad printer software
Ever used lpadmin? It's a big pain—command line oriented with little error checking. It's hard to use and has many options to get you into trouble. That's why I prefer CUPS, Common UNIX Printing System, which is used mostly on Linux and has web-based menus. The CUPS menus only present relevant options and have extensive error checking.
The tutorial below shows how to use CUPS to access one network printer from Solaris 10. The network printer I use happens to be a IOGEAR USB Print Server attached to my local home network and a EPSON STYLUS COLOR C86 printer. This print server works with the LPD protocol (for Linux/Solaris) and MS Windows printing protocols.
Installing CUPS is available from the "Software Companion" CD (along with all the other SFW\* open-source packages). You want package SFWcups, and probably SFWcprnt, which also bundles packages SFWespgs, SFWhpijs, SFWxpp, SFWgprnt). Pre-compiled CUPS packages are available elsewhere, such as sunfreeware.com
Disabling Solaris lp\* commands (optional) To avoid confusion, I recommend disabling Solaris lp\* commands. Applications typically use /usr/bin/lp to print and it's easy to forget to reconfigure. I recommend renaming the old commands and linking to the CUPS commands. Here's a sample shell script to do this:
#! /bin/sh cd /usr/bin for i in lp lpstat cancel enable ; do mv $i $i.old ln -s /opt/sfw/cups/bin/$i . done cd /usr/sbin for i in lpadmin lpmove accept ; do mv $i $i.old ln -s /opt/sfw/cups/sbin/$i . done
Enabling CUPS Add /opt/sfw/cups/bin to the PATH of each user, in front of /usr/bin. Also add /opt/sfw/cups/sbin to the PATH of each print administrator, in front of /usr/sbin. Enable the CUPS daemon, cupsd, with this shell script:
#! /bin/sh cp /opt/sfw/cups/etc/init.d/cups /etc/init.d for i in rc0.d rc1.d rcS.d ; do ln /etc/init.d/cups /etc/$i/K00cups done for i in rc2.d rc3.d ; do ln /etc/init.d/cups /etc/$i/S99cups done /etc/init.d/cups start /etc/init.d/cups statusNext, set the CUPS root password (saved in file /opt/sfw/cups/etc/cups/passwd.md5). This password may be the same or different from your UNIX root password. Set it with this command:
/opt/sfw/cups/bin/lppasswd -g sys -a root
No modification of the cups.conf file is required, the file is at/opt/sfw/cups/etc/cups/cupd.conf The cups.conf file is extensively documented in the CUPS Software Administrators Manual (SAM)
Initial CUPS setup To setup your first printer with CUPS, after starting cupsd agove, go to http://localhost:631/ Beware that if you access this URL remotely, transactions, including CUPS passwords, can be viewed over the network. This is why remote access disabled by default in cupsd.conf. Here's the steps I took to enable my network printer on server "adams" (defined in /etc/hosts) with network print queue "lp1":
- Click "Do Administrative Tasks" and enter your CUPS account (root) and CUPS root password
- Click "Add Printer"
- Fill in the form. For sanity reasons, I use the same name for the local queue as for the remote network queue (lp1):
- Name: lp1
- Location: In office
- Description: Epson Stylus C86
- Device: I selected "LPD/LPR host or printer"
- Device URI. I used "lpd://adams/lp1" (without the quotes). Here's some other examples:
- Model. I used "EPSON"
- Model/Driver for lp1. Select the model closest to your printer. Try different drivers if one doesn't work. The menu just uses PPD drivers in /opt/sfw/cups/share/cups/model/\*ppd. Solaris \*.ppd drivers are in /usr/lib/lp/model/ppd/\*.ppd (package SUNWfppd). See also if your printer manufacturer has a \*.ppd printer driver file for their printer on their web site. I selected "Epson Stylus COLOR C84-CUPS+Gimp-Print", as C84 is the closest to my C86.
- It should now say "Printer added successfully." Click on the printer link and click "set as default"
- Verify the printer works by clicking "Print test page"
- Try printing also from your favorite app, such as Firefox, StarOffice, or OpenOffice.
Printer defaults The above steps sets the default printer. You may want to make sure the default is not easily overridden by setting the PRINTER and LPDEST environmental variables and setting up a $HOME/.printers file looking something like this:
_default lp1 _all lp1This step is the same for Solaris whether or not you use CUPS.
Removing old print server software (optional). To reduce errors and confusion, I removed the old printer software. You may want to wait until you're sure you want to use CUPS and not go back to the default Solaris printing tools and server. The packages can always be re-added from the install DVD. The softare package removal may be done with this script. Answer "y" to the prompts when running:
#! /bin/sh for i in server cleanup rfc1179 ; do svcadm disable print/$i done pkgrm SUNWscplp SUNWppm SUNWpsu SUNWpsr SUNWpcu SUNWpcrThis disables the old print services and removes these packages:
- SUNWpsr Solaris Print - LP Server, (root)
- SUNWpsu Solaris Print - LP Server, (usr)
- SUNWpcr Solaris Print - Client, (root)
- SUNWpcu Solaris Print - Client, (usr)
- SUNWscplp Solaris Print - Source Compatibility, (Usr)
- SUNWppm Solaris Print Manager
Update 12/2008: CUPS has been removed from the S10 10/08 (U6) Companion CD, due to legal restritions on the Berkeley DB package. It is available in OpenSolaris as package SUNWcups and for S10 you may be able to use the SFWcups from an earlier version of the Companion CD, or download from blastwave.org Blastwave, or download source from CUPS