CUPS and Sun

I recently spent some time getting one of my long term projects built. For quite some time I've had an old desktop computer serve as my printer server. As this machine is kind of loud, I've turned it off when not using it. This led to some client machines not appreciating the printer becoming available at the wrong time.

In my posession I also had an old mini-itx board with passive cooling (large heat sinks) and a pair of sun portable scsi hdd cases. Incidentally, the latter fit into the former. The plan for a new print server was born.

The build itself turned out to be pretty straightforward. A 8GB CF-card serves as harddrive and an 80W pico-PSU was used to move the AC-DC conversion outside the box to a power brick delivering 12V DC. The resulting system is dead silent and does not use much power.

On the software side I installed debian. This was for two reasons: the debian netinst images helps installing a compact system without having to download gigabytes, and debain comes with a kernel that plays nice with my old Via C3 processor (which lacks the optional i586 cmov instruction).

Having run the installer and installed a minimal system, time came to install the printer server functionality. This is easier than you might think, simply apt-get install the cups package. I installed some of the recommended packages as well, but basically cups will do it.

Having installed cups, you need to tweak the /etc/cups/cupsd.conf to make cups available to the rest of the world. The Listen localhost:631 line can be changed to Listen 631. BrowseAllow should allow all. Also, the Location / tag needs the line Allow all. After these changes, simply restart cups using /etc/init.d/cups restart. Now you should be able to reach your new machine as ip.of.the.machine:631.

The cool kids now open localhost:631, pick admin, log on and add the printer. However, here, the coolest browser is Lynx and I don't feel lika configuring printers using Lynx. Instead, I do it over the command line. How do you do this? Basically, it takes three steps. First, use lpinfo to locate your printer(s). You might want to run this as root, as it is located in the /usr/sbin directory. 


# lpinfo -v 
network socket
network beh
direct usb://HP/color%20LaserJet%202550%20series
network http
network ipp
network lpd
direct parallel:/dev/lp0
direct scsi
serial serial:/dev/ttyS0?baud=115200
network smb

As you can see, a whole range of options are listed, but one item is the printer in question - in this case my old trusty HP2550. The lpadmin command is then used to add the printer to the system. In the line below, it is added with the name hp2550, -v specifies the printer in question and -P picks out a ppd file (i.e. a printer configuration). 

# lpadmin -E -p hp2550 -v "usb://HP/color%20LaserJet%202550%20series" -P /usr/share/ppd/cups-included/HP/laserjet.ppd

The -E option is important as it enables the printer in cups and starts accepting jobs for it. You can do this afterwards using the following commands if you'd like to. 

# cupsenable hp2550
# accept hp2550

 Another tweak that is good to know is how to set the default printer. 

# lpadmin -d hp2550

For some reason the laserjet.ppd did not really cut it for my needs. For instance, the results came out as black and white. Using the printer database over at, I was able to retreive a new ppd for my printer. Then I simply replaced the ppd in the /etc/cups/ppd directory and I had color printing. For the fine tuning, the lpoptions command is handy. For instance, changing the paper size to A4 as as simple as this. Just entering lpoptions without any arguments prints out a list of settings for each printers. From this list, you can figure out which options to tune. 

# lpoptions -p hp2550 -o media=A4

Now I can add the printer as a PostScript printer is both Linux and Windows and it Just Works. With my new print server hardware it will always be on and the box looks so pretty in my geeky eyes. FYI, I do power off the printer when it is not used, but the server simply queues jobs.



Johan Thelin is a consultant working with Qt, embedded and free
software. On-line, he is known as e8johan.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

this article is really

marttrox's picture

this article is really nice,When read this article i feel great...!thanks for posting it..! Leanspa

lynx and configuring CUPS

Anonymous's picture

Unfortunately, recent versions of CUPS appear to demand javascript, so configuration with lynx no longer works.

Mate thanks very much for the

JesusofOz's picture

Mate thanks very much for the article and some very useful information.

And on behalf of the great majority of normal people, apologies for the seriously sad people who seem to have infected this page.

Hi Johan, thanks for taking

freds72's picture

Hi Johan, thanks for taking the time to write about your experiences making a print server. It gave me some clues about setting up my own server and taught me something about command line administration.
Please don't be put off by the vitriolic outpourings of a frustrated wannabe who is too scared to even put his name to a rant. There are a few people like him out there
but most people seem to have more appreciation for somebody who tries to embody the linux spirit by helping others.


Not only poorly written but also amateur to the bone.

Anonymous's picture

The epitome of laziness. You had to install a foreign file, that btw breaks ucf and Debian's package manager database, when all you had to do was to "locate laserjet | pager-of-your-choice" to scroll the output and find:


and then choose it as the PPD for your printer. There, I found out the file for you.

Children, here we have another example of the hoof and horn school of system administration.

Breaking stuff

Johan Thelin's picture

Sorry to upset you by introducing a foreign file. I could not locate the ppd as I had not installed hplip (due to laziness, yes). However, I'm not sure if I'm actually broken ucf nor the package manager database. Note, the following lines are just my understanding of how things work - feel free to correct me if I'm wrong.

The ppd I put in /etc/cups/ppd is not handled by the package manager per se. It is copied there by the lpadmin command. Thus, I would not say that I broke the package manager database.

The ppd I put there is a configuration file, which affects ucf. However, I'm not sure that I broke it. If a package being updated wants to change my ppd, it will simply present me with the usual options (keep yours, use the new, merge manually, or whatever they are). Thus, this is not worse that modifying a configuration file by hand, and that is a routine task for me.

You may call that sloppy system administration if you like. However, modifying configuration files is, in my world, what they are there for. If the files are deadly important, I try to version control them. I also keep a wiki with the setup details for all my critical systems so that I can re-configure a new server to the same status easily.

Regarding poorly written, please see my remark further down the comments. No excuses, but a promise to improve.

Johan Thelin is a consultant working with Qt, embedded and free
software. On-line, he is known as e8johan.

Why was this article not

Anonymous's picture

Why was this article not proof-read? There are copious grammatical and spelling errors. Linux Journal, please strive for quality.

heh speling

Anonymous's picture

Yeah, lots of errors! LJ, you're not wasting paper when you make corrections on a Web page :) Please, this is a good article that deserves proper editing.

Spelling, time and no excuses

Johan Thelin's picture

I'm sorry that the blog entry was sub-par. To my defense, I'm not a native speaker, but I will do what I can to improve. Unfortunately, I had no-one to bounce this particular article by when writing it up (in a spur of inspiration on my n900).

Unfortunately, I cannot edit and correct what has been published, all I can do is promise to take more care in the future. I hope that you enjoyed the contents, and that you will enjoy the reading experience in the future.

Johan Thelin is a consultant working with Qt, embedded and free
software. On-line, he is known as e8johan.

Perfect timing!

xiao_haozi's picture

Nice post... great timing considering we can now setup cloud printing on nix (!

Looks like this weekend just got booked up.

Cool project!

linux in NE ohio's picture

Love the old-school Sun hardware! I've got an old Sun lunchbox that I've been planning to do the same project with, except with the addition of a large hard drive for a print/NAS combo. I guess I have no more reasons to put it off...


YellowSPARC's picture

I had such a machine (SparcClassic) for years, serving as a print and FAX server (serial modem, external ISDN converter, sendfax+mgetty). Unfortunately it finally broke a few months ago and though they are dirt cheap and still available I won't replace it, as Debian/sparc32 (AFAIK the last existing distro supporting sun4m) has been dead for years now and the last version of Solaris to support Sparc32 was some intermediate update of 9. No chance to get that one from the new Overlords...
It's a shame as there must be thousands of these machines still around and working.

Geek Guide
The DevOps Toolbox

Tools and Technologies for Scale and Reliability
by Linux Journal Editor Bill Childers

Get your free copy today

Sponsored by IBM

Upcoming Webinar
8 Signs You're Beyond Cron

Scheduling Crontabs With an Enterprise Scheduler
11am CDT, April 29th
Moderated by Linux Journal Contributor Mike Diehl

Sign up now

Sponsored by Skybot