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 http://www.openprinting.org/printers, 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.
|Privacy Is Personal||Jul 02, 2015|
|July 2015 Issue of Linux Journal: Mobile||Jul 01, 2015|
|July 2015 Video Preview||Jul 01, 2015|
|PHP for Non-Developers||Jun 30, 2015|
|A Code Boot Camp for Underprivileged Kids||Jun 30, 2015|
|Comprehensive Identity Management and Audit for Red Hat Enterprise Linux||Jun 29, 2015|
- Physics Analysis Workstation
- Attack of the Drones
- Django Templates
- Secure Server Deployments in Hostile Territory
- PHP for Non-Developers
- Practical Books for the Most Technical People on the Planet
- The AtoMiC Toolkit!
- Take Control of Growing Redis NoSQL Server Clusters
- Comprehensive Identity Management and Audit for Red Hat Enterprise Linux
- Privacy Is Personal