Sunday, January 23, 2011

Print from Linux to a Windows Shared Printer

setting up a print in cups to connect via samba share (or so I thought):

highly recommend the site openprinting.org, they have a very thorough list of printers, and their known working states

I have a Samsung ML-2010, so the drivers aren't included by default for linux, and wonderful Samsung isn't going to help us out.

Some sites that have helped:

- http://www.linuxfoundation.org/collaborate/workgroups/openprinting/database/driverpackages
- http://www.linuxfoundation.org/collaborate/workgroups/openprinting/database/cupsdocumentation
- http://localhost:631/admin (for those unfamiliar, this is the local web management interface for CUPS)
- http://tldp.org/HOWTO/SMB-HOWTO.html#toc8

well, this battle is finally over.  When I started, I had a small Zonet ZPS2102 print server (that I've had for years) and it was currently set up over the network and successfully allowing windows systems (XP and 7) to print to it via a samba share.  However, as I've been moving to a truly mixed environment at home, I needed to get my linux systems printing capability.  I wanted to do this without changing where the printer was plugged in so I didn't lose printing capability in the process.  Basically, add the linux systems without affecting anything else.

After banging my head against the SAMBA/CUPS wall for several hours, I decided to try the LPD/LPR configuration on the print server.  This was after I'd visitied several sites, learned more about SAMBA than I was expecting at this point, reworked the /etc/samba/smb.conf file several times, and finally plugged the printer into my computer to see if the drivers were working.

With a successful print from a direct physical connection, I decided to try the LPD/LPR config, and it worked like a charm.  I hope this saves you some time, I know I'll certainly remember it.  So...


Total time to complete this is about 15 to 20 mins tops.  (I'll spare you the extra book I wrote while I was banging my head agianst a wall.)

Setting up a ("non"-) supported printer like the Samsung ML-2010 on linux:

WARNING... if you are on RHEL/CEntOS 5.5, you will only have LSB 3.1 installed (and no way to get to LBS 3.2 without compiling it yourself), so make sure you download the correct splix rpm for RHEL/CEntOS 5.

verify signature
[user@linuxbox Downloads]$ rpm -K splix-1.0.1-3lsb3.1.i486.rpm
splix-1.0.1-3lsb3.1.i486.rpm: sha1 md5 OK

you also need to confirm you have the rest of the tools to make this work:

# yum install foomatic ghostscript
# yum --nogpgcheck localinstall splix-1.0.1-3lsb3.1.i486.rpm


navigate to /opt/splix/ppds/Samsung/ and use gunzip to extract the file you need, the files that are installed with .gz won't work for CUPS:

# cd /opt/splix/ppds/Samsung
# gunzip -d Samsung-ML-2010-splix-en.ppd.gz

on the system you want to install the printer on, go to:
http://localhost:631/admin

Click on Administration tab
Click on Add New Printers
click on Add Printer
    under Name: => <Unique_Printer_Name> (PrintServer_Samsung_2010)
        click contiue
    select "LPD/LPR Host or Printer", click continue
    device URI: => lpd://<hostname_or_ip>/<lpd_queue_name>
         (in my case, lpd://192.168.x.x/Samsung_2010)
    Select "Browse" and browse to /opt/splix/ppds/Samsung/
         Select the file you unzipped above, click Open
    Click "Add Printer"

Click on the Printers Tab
Assign the printer as the default, and print a test page.

Happy Printing!


Extra points: REMOTE INSTALL

To install this remotely, the only extra step was to log in to the other system via ssh with X11 forwarding enabled (-X), and then running "firefox &" to get the web interface for CUPS.  Total time is still the same.

$ ssh -X -l user 192.168.x.x  (to log in)



I think it is worth noting that I acheived my goal of getting my linux systems to be able to print, but I did not complete my stated goal when I started, which was to set up the printer via SAMBA/CUPS.  However, this works just as well for me.

Take-away lesson: if there's another configuration possibility that you haven't tried and you're having to dig deep to solve what you're on, try the other route first.