Configure Linux From Scratch
Description: HP Linux Imaging and Printing - HPLIP is an HP developed solution for printing, scanning, and faxing with HP inkjet and laser based printers in Linux.
Keywords: HPLIP, HP, Linux, Printing, HPIJS

Home > Installation > Manual Install > Linux Distributions > LFS/BLFS

# Manual Build and Install Instructions for Linux From Scratch

# Step 1: Installation Prerequisite Steps

Important

This process has not been tested on HPLIP 2.x

Note

This process has not been tested by the HPLIP Team and is not supported.

View the current Release Notes for additional information on this release.

Note

You will need root access to complete many of the steps while installing HPLIP. If you do not have root access contact your system admin for assistance.

Installing hplip-1.7.1 on an LFS/BLFS system

This document describes the installation of hplip-1.7.1 on a Linux from Scratch (LFS)/Beyond Linux from Scratch (BLFS) setup.

Some system components of the LFS/BLFS build on which this experience is based are: gcc-4.0.3 ; glibc-2.3.6; udev-088; Linux-2.6.16.5; python-2.4.3; libusb-0.1.12; xfree86-4.5.0; gimp-2.2.10; cups-1.1.23; ESP_Ghostscript-8.15.1; sane-1.0.17; foomatic-3.1.0.

The procedure installs hplip in a directory different from /usr or /usr/local. If these standard locations are used, some of the configuration steps may be omitted.

It is assumed that:

1. All the system requirements for the building of hplip are met;
2. Hplip-1.7.1.tar.gz has been untarred into a directory we shall call "Build" and that the patch hplip-1.7.1-1.patch has been copied to this directory. The contents of Build should look like this: hplip-1.7.1/hplip-1.7.1-1.patch;

The various steps are described below.

First as an unprivileged user:

    $ cd hplip-1.7.1
    $ patch -Np1 -i ../hplip-1.7.1-1.patch
    $ sed -i "s@daemon@pidofproc@g" hplip.sh
    $ ./configure --prefix=/usr/local/Hplip-1.7.1 --disable-network-build --disable-pp-build
    $ make

Explanations:

sed -i "s@daemon@pidofproc@g" hplip.sh is done to replace the 'daemon' function in hplip.sh with 'pidofproc'. Lfs does not use 'daemon' at all, but 'pidofproc' in stead.

--disable-network-build: if you do not have net-snmp installed.

--disable-pp-build: if your printers do not connect to the parallel
  port.

Next, as root:

    # export HPLIP_DIR="/usr/local/Hplip-1.7.1"
    # mkdir -p $HPLIP_DIR/bin
    # make install

Explanations:

You need to do the 'mkdir' bit because hplip will not create the 'bin' directory and installation will fail as a result. If you install in /usr/local or /usr this would not be a problem.

Now you need to configure for hplip (still as root):

    # chmod 0744 $HPLIP_DIR/share/hplip/hplip
    # cd /etc/rc.d/init.d
    # ln -s $HPLIP_DIR/share/hplip/hplip hplip
    # cd ../rc0.d
    # ln -s ../init.d/hplip K01hplip
    # cd ../rc3.d
    # ln -s ../init.d/hplip S24hplip
    # cd ../rc5.d
    # ln -s ../init.d/hplip S24hplip
    # cd ../rc6.d
    # ln -s ../init.d/hplip K01hplip
    # cd /usr/bin
    # ln -s $HPLIP_DIR/bin/hpijs hpijs
    # cd ../lib/sane
    # ln -s $HPLIP_DIR/lib/libsane-hpaio.* .

Find the path in /dev to the printer. This is done by ls /dev and looking for the usb/ directory, for example. Suppose the path is /dev/usb/lp0

Edit /etc/profile and add the line

    export SANE_DEFAULT_DEVICE="hpaio:/dev/usb/lp0"

Then run the command:

    # . /etc/profile

To /etc/ld.so.conf add the line

    /usr/local/Hplip-1.7.1/lib

and run the command

    # ldconfig

Finally:

    # unset HPLIP_DIR

Explanations:

-- The 'hplip' binary as installed is not executable, hence the "chmod" step.

-- The lfs-setup has 'init.d' in a place different from what the installation procedure expects. We have to make a symlink in ' init.d' to where 'hplip' is.

-- The symlinks set up in the rc.{0,1,3,5,6} directories will activate the two hplip daemons at boot time and bring them down at shutdown time. It is important to note that these daemons must be activated before the 'cups' daemon and shut down after the 'cups' daemon. Thus the numbers 'xy' in the 'Sxy' links must preceed those for 'cups'. The 'xy' in 'Kxy' must be larger than those for cups. So have a good look at what goes on in the 'rc.n' directories.

-- It is important to have a link in /usr/bin to the 'hpijs' binary. Without this link 'cups' will get lost. That is one reason why installation of 'hplip' in /usr is recommended.

-- Sane will look for the 'libsane-hpaio' libraries in /usr/lib/sane. So we have to establish a link. Without these links scanning at least with 'xscanimage' will not work. The final dot in the command line should not be left out.

-- The environment variable SANE_DEFAULT_DEVICE will make 'xscanimage' work from wherever it is called. This really is a nice thing to do!

-- Having 'ldconfig' make the hplip libraries visible to the system may be of importance to software that leans on hplip.

If you set the variable SANE_DEFAULT_DEVICE do not give a command to xscanimage when you configure.

Hopefully this is of value to users of other Linux distributions as well.

Documentation provided by Niko Sauer

# Step 2: Install Dependency Packages

Use the Other Linux Distros page for a list of required depencency packages.

Use your distro documentation for installing the packages.

# Step 3: Download HPLIP

Note

We recommend that you download the HPLIP tarball to your home or desktop directory.

A. Click here to Download the Regular Tarball

B. Go to the directory where you downloaded the HPLIP tarball.

Example:

    cd ~/Desktop

C. Uncompress the tarball.

Enter this command:

    tar xvfz hplip-2.7.10.tar.gz

This will create a directory with the same name as the tarball file.

D. Change your working directory to the hplip-2.7.10 directory.

Example:

    cd hplip-2.7.10

# Step 4: Configure HPLIP for installation

A. This step configures the development environment and checks that your system is ready to install HPLIP.

For specific information on using ./configure and the different options please go here. Also reference your distro documentation and configuration for additional information on which tags are relevant.

Enter this command (select the appropriate command depending on your system configuration):

32 bit distro users (most users will use this command):

    ./configure --prefix=/usr

64 bit distro users

    ./configure --prefix=/usr --libdir=/usr/lib64

# Step 5: Run Make

A. This step will compile the HPLIP source.

Important

You want to run make as a regular user, NOT as root.

Enter this command:

    make

# Step 6: Run Make Install

A. This step will install HPLIP.

Enter this command:

    su -c "make install"

# Step 7: Post Installation Step(s)

A. If you are going to be setting up a printer with USB and the printer is already plugged in, you will need to do one of the following:

1. Unlpug and re-plug in the USB printer, or
2. Restart your PC.

Failure to do this will cause your USB printer to not be detected by HPLIP.

# Step 8: Configuring your printer using hp-setup

Continue to hp-setup

Page last updated: Thu Sep 13 14:58:19 2007; HPLIP Version: 2.7.10