Monday, February 21, 2011

Installing a HP network printer.

Installing a HP network printer.

Introduction.

This guide covers the steps required to install a HP network printer on Linux using either the GUI printer configuration tool included with
Fedora or the browser based CUPS admin page available to all Linux distributions. This particular example uses a HP Photosmart 2575 printer on
Fedora but the principles involved apply to any network printer on Linux.

Get the hplip rpm

First check to see if you have installed the hplip (HP Linux Imaging and Printing) package, this is available as an rpm in the repositories
included in the default Fedora yum setup. To check open a terminal and type:

$ rpm -qa|grep hplip
hplip-1.6.12-1.fc6


If you get something like this then you're good to go, if not you can install hplip via yum.

$ sudo yum install hplip


Alternatively you can download the hplip rpm manually from the
Fedora Core updates page.

By default the hplip service will be set to start on the next boot but to get it started now type:

$ sudo /sbin/service hplip start


If for some reason the hplip service is not set to start on boot just use chkconfig to set this up, here I set hplip to start on boot in run
levels 3,4 and 5.

$ sudo /sbin/chkconfig --level 345 hplip on


Download the PPD file

This step may not be necessary if your printer is already included in the foomatic database, to query the list just use:

$ foomatic-ppdfile -A


This returns a long list of all files, to check for yours try to filter the output with grep, for example for my printer:

$ foomatic-ppdfile -A|grep 2570
HP PhotoSmart 2570 Id='HP-PhotoSmart_2570' Driver='hpijs'
Toshiba DP2570 Id='Toshiba-DP2570' Driver='Postscript'


Here I can see on Fedora Core 6 the PPD file for the HP 2570 is included (it wasn't on Fedora Core 5) so there's no need for me to download the
file.

If you can't find a suitable PPD file you need to download one, these are
available from Linuxprinting.org.
Simply select your make and model and then click on the 'download PPD' link near the top and save the file to your home directory. If you don't find your
exact model just select the next lowest number, in my case I have a Photosmart 2575 but use the ppd file for the 2570. Copy or move this file to
/usr/share/cups/model/.

$ sudo cp *.ppd /usr/share/cups/model/


Now we should restart the CUPS service to pick up the new PPD file:

$ sudo /sbin/service cups restart



Give the printer a static IP address.

I would strongly recommend setting up your printer with a static IP address otherwise the next time you start your network it may get
different IP address from your DHCP server.

There are 2 ways to do this, the first and easiest one is to log in to your router and assign an IP address to the MAC address of the printer.
This option will probably be on the LAN setup page but will depend on your router. This will ensure the printer gets given the same IP address every time.

The other method is from the printer itself. On HP Photosmart printers you first need to get the current IP address of the printer, use the buttons on the printer to get this information,
press 'Setup' > 'Network' > 'View Network Settings' > 'Display Wired Summary', write down the IP address and point you web browser to
http://printer_address. This open a web utility to manage the printer, from here you can select the Networking tab and 'Wired (802.3)' menu to
choose from 'Automatic IP' or 'Manual IP'. Select 'Manual IP' and add the entries for your network.


Setup the printer

Next we need to set up the printer. Make sure the printer is connected to the network and turned on, then in a terminal type as root:

$ hp-setup -m <ip.address.of.printer>


Just follow the steps through to give your printer a name, location etc. , these are not important but just let you recognize the printer if you have
many installed. The utility should pick up on the ppd file you copied to the /usr/share/cups/model/ folder.


Install the printer using CUPS

Next we need to configure CUPS with the printer. First get the URI required for the printer.

$ hp-makeuri <printer.IP.address>

HP Linux Imaging and Printing System (ver. 1.6.12)
Device URI Creation Utility ver. 4.3

Copyright (c) 2003-6 Hewlett-Packard Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

 Creating URIs for '<printer.IP.address>':
CUPS URI: hp:/net/Photosmart_2570_series?ip=<printer.IP.address>
SANE URI: hpaio:/net/Photosmart_2570_series?ip=<printer.IP.address>
HP Fax URI: hpfax:/net/Photosmart_2570_series?ip=<printer.IP.address>


The next step can either be done through a web browser or using system-config-printer on Fedora. If using Fedora Core 5 or older I would use the web interface
but on Fedora Core 6 the system-config-printer has been overhauled and is now very useful.

system-config-printer based set up.

This is located under Start menu > System > Administration > Printing, or simply system-config-printer in a terminal. If not available just
install using yum install system-config-printer.

Click on 'New Printer' and enter the printer details, name, description and location, click on 'Forward' and on the next page 'Select Connection'
in the left pane 'Devices' select 'other' and enter the CUPS URI we created above e.g. hp:/net/Photosmart_2570_series?ip=192.168.1.2

Add printer select connection

On the next screen either select your printer make or select your PPD file, finally select your printer model and driver before completing the
setup.

Add printer select model

CUPS browser based set up.

Open a web browser and go to http://localhost:631, this is the CUPS administration page. Click on
 'Add Printer' and then on the first screen just type basic information on the print queue, the name must not contain any spaces.

On the second screen for 'Device' select 'AppSocket/HP JetDirect' and the next screen for 'Device URI'
paste in the CUPS URI we generated above.

CUPS device URI

On the Make/Manufacturer screen select your either your make, HP in my case, and continue or you can just select your PPD file at the bottom and
add your printer.

Finally select your Model/Driver from the list provided or again you can browse to a PPD file on your computer.

CUPS Model/Driver page

That's all there is to it, also when you do this Xsane will be set up so you can now scan from the device as well.

If you want to see a fancy UI for your printer you can run hp-toolbox from the command line, this shows you the ink levels,
print jobs and many other settings.

HP toolbox utility

Add a Gnome menu entry for hplip

It's also possible to add a Gnome menu entry for the toolbox, installing the hplip rpm does actually install a .desktop file but it's hidden by default.
To show the menu entry open a text editor and edit the following file as root, in my case I use vi:

$ cat /usr/share/applications/HP-hplip.desktop
[Desktop Entry]
Version=0.6
Type=Application
Name=HP Device Manager
GenericName=HP Device Manager
Comment=View device status, ink levels and perform maintenance.
Exec=/usr/share/hplip/toolbox
Icon=/usr/share/hplip/data/images/HPmenu.png
Terminal=false
Categories=Application;Utility;X-Red-Hat-Extra;
X-KDE-StartupNotify=false
StartupNotify=false
Hidden=true
Encoding=UTF-8
X-Desktop-File-Install-Version=0.10


Just edit the bold line that says Hidden=true to say Hidden=false, then save and close the file. The next time you open the Accessories menu you'll see an icon for the HP toolbox.

HP toolbox menu
http://bobpeers.com/img/hp_printing/hp-toolbox-menu.png

0 Comments: