to HP for providing an installer that does all the job on its own.
My printer is an HP Deskjet D2360. First goto the site -
http://hplipopensource.com/hplip-web/install_wizard/index.html
Then select Distribution, Version, Printer type and Model
Proceed to download the installer and move it into a folder. ( A separate folder)
The downloaded file will be something like hp
access this folder then run the installer by typing
$sh hp[version]
If you don't put the installer in a separate folder the default directory will be flooded with
installation files.
The installer itself will recommend you to run the installation as default user. Provide the
administrator/root user password when you are asked to.
Select automatic installation(Recommended by default). Proceed to answer some simple
questions and the installer will automatically download and install any dependancies if
required.
Then it will ask you to replug the printer and the installation is done. You can print a test page
if needed.
The HP download page also contains detailed instructions to run the installer.