Thursday, May 14, 2009

Setting up HP printer and CUPS on Xubuntu or Mythbuntu

My NSLU2 Unslung install quit booting for the 2nd time. Initially several hours of research, trial, and error, got the Slug recognizing the hard drive and booting again. This time the same steps didn't work. I decided the Slug isn't worth the trouble since my Mythbuntu machine is always running too. Now the Slug services (file/print/itunes server) will go on the Myth machine. Hopefully that will be more stable. Mythbuntu is a Ubuntu distribution of MythTv, a TiVo like software package.

Unless you are a masochist, only buy a HP, or maybe an Epson printer to use with Linux. Fully postcript compliant network printers are also "easy" to set up. Anything else, and you are asking for a visit to the nut house.

The docos for Ubuntu are some of the better around, but at times they leave much to be desired. Mythbuntu is really a Xubuntu distro with a lot of the desktop based packages yanked out and the media player added in. Xubuntu docos are like the red-headed step-child of the Ubuntu world.

It took me a while to figure out due to incomplete and some inaccurate info, but Mythbuntu doesn't come with a subsystem to recognize printers and try to set them up. With a HP printer, you need to install (using Synaptic) "hplip" and "hplip-gui". Your printer may not be recognized without restarting. Supposedly hotplugging is sufficient, but it didn't work for me. You should now have a HP icon in the top right corner; you can click on it, go to settings, print test page and the printer should work.

Now I want to print from other computers. CUPS is what I use, and it is installed as a dependency of hplip, but it is not set up correctly by default unless you are only printing from the computer it is attached to. And why the hell would you use CUPS for that? To get CUPS set up correctly for printing from any computer on your network, you need to
sudo nano /etc/cups/cupsd.conf
And edit the following lines

Where it says...
# Only listen for connections from the local machine.
IF the IP address of your Myth machine the printer plugs into is 192.168.1.100, then add...
Listen 192.168.1.100:631

Where it says...
# Restrict access to the server... Order allow,deny
If all your computers have ip addresses 192.168.1.xxx then add
Allow from 192.168.1.0/24
And add the same "Allow from" directives again under the headers
# Restrict access to the admin pages...
# Restrict access to configuration files...

Now you must restart CUPS by running the command
sudo /etc/init.d/cups restart

You should now be able to view and edit the CUPS server information on the Myth computer, or any other computer by going to http://192.168.1.100:631 in your browser. You should get no 403 Forbidden! errors.

To add the printer on another Ubuntu machine, go to http://localhost:631. Choose "Add printer," answer some of the BS questions, and use the printer location http://192.168.1.100:631/printers/nameofyourprinter

You can add the printer on a Windows computer similarly by going to "Add a network printer" and giving the above address.

I'll post how to add SAMBA file sharing features and iTunes mt-daapd song sharing features to a Mythbuntu install later. This is also so I'll remember how to repair my install when it inevitably craters in the future.

1 comment:

  1. Thank you very much for this information!!! This was very helpful for me. :-)

    ReplyDelete