Linux HOWTOs

About | Home | Search


HOWTO: hplip
Description: HP Linux Imaging and Printing System
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# HPLIP 3.10.5
# ============
# HP originally game out with HPIJS, which was drivers for Inkjet printers. 
# How there's HPLIP, which covers printing, scanning, and faxing with HP
# devices.  HPIJS is part of HPLIP.

# See http://hplipopensource.com/hplip-web/supported_devices/ to see if yours is
# covered.  There are 1,971 supported printer models as I write this.

# Slackware is considered not supported, but it's not too difficult to get
# it to work with some tweaking.  If you don't want to deal with the
# procedure, use a HPLIP package instead.
#
# Slackware 12.0: hplip 1.7.4a
# Slackware 12.1: hplip 2.8.4
# Slackware 12.2: hplip 2.8.10
# Slackware 13.0: hplip 3.9.4b
# Slackware 13.1: hplip 3.10.2
#
# You can also find packages at LinuxPackages here:
# http://www.linuxpackages.net/search_view.php?by=name&name=hplip
# (I have not tried any of them)

# If you previously had HPIJS installed (the old standalone HPIJS), go to
# it's howto first to uninstall it, then come back here.

# Prerequisites for just HPIJS:
# libjpeg
# CUPS

# Additional prerequisites for the whole HPLIP package:
# Net-SNMP >= 5.0.9 (optional; for network support)
# Python (optional)
# libusb >= 0.1.8
# Qt (optional)
# PyQt >= 3.14 (optional; for HP Device Manager)
# ReportLab (for fax cover page support)
# psmisc's (or sysvinit's) pidof (used by the init script)

# The release notes for this one are here:
# http://sourceforge.net/news/?group_id=149981&id=286652

cd
test -f installed/hplip-3.10.5.tar.gz &&
 mv installed/hplip-3.10.5.tar.gz .
test ! -f hplip-3.10.5.tar.gz &&
 wget http://downloads.sf.net/hplip/hplip-3.10.5.tar.gz

# Verify tarball w/ md5sum:
# (this came from my gpg-verified tarball)
echo "a4a3679d5987520226ef70d834b63b88  hplip-3.10.5.tar.gz" | md5sum -c

# Verify tarball w/ sha1sum:
# (this also came from my gpg-verified tarball)
echo "4e6e534983311af6991245e99814a44d857cda8d  hplip-3.10.5.tar.gz" \
 | sha1sum -c

# Verify tarball w/ gpg:
( gpg --list-keys A59047B9 2> /dev/null || gpg --recv-keys A59047B9 ) &&
 wget http://downloads.sf.net/hplip/hplip-3.10.5.tar.gz.asc &&
  gpg --verify hplip-3.10.5.tar.gz.asc && rm hplip-3.10.5.tar.gz.asc

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "hplip-*" -exec rm -r {} \;
tar xzvf ~/hplip-3.10.5.tar.gz
cd hplip-3.10.5
test $UID = 0 && chown -R root:root .

# If you don't want to install the GUI parts, which might be the case if
# you're just installing CUPS on a server or something like that, continue
# here.  If you want to install the whole package, skip down to WHOLE
# PACKAGE below.

# You can also run ./hplip-install here and let the Python script
# do the work for you, or run it the usual way with configure, make,
# etc.

# Configure the build
./configure --prefix=/usr --sysconfdir=/etc \
--docdir=/usr/doc/hplip-3.10.5 \
--localstatedir=/var \
--enable-hpijs-install \
--disable-network-build \
--disable-scan-build \
--disable-gui-build \
--disable-fax-build \
--enable-shadow-build \
--enable-foomatic-drv-install \
--enable-foomatic-rip-hplip-install \
--disable-qt4 \
--with-docdir=/usr/doc/hplip-3.10.5

# Build it
make

# Become root to install it
su

# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg hplip

# If this is an upgrade, remove old files:
# (for a more complete removal, skip down to the bottom)
for pfx in /usr /usr/local;
do
  find ${pfx}/bin -type l -name "hp-*" -exec rm {} \;
  rm -f ${pfx}/bin/hp-mkuri ${pfx}/bin/hpijs
  find ${pfx}/doc -type d -name "hplip-*" -exec rm -r {} \;
  find ${pfx}/share/doc -type d -name "hplip-*" -exec rm -r {} \;
  test -d ${pfx}/share/hplip && rm -r ${pfx}/share/hplip
  test -d ${pfx}/share/ppd/HP && rm -r ${pfx}/share/ppd/HP
done

# Install it
make install

# If you passed --disable-gui-build to configure above, remove these things
# that you won't need
rm -f /etc/xdg/autostart/hplip-systray.desktop \
/usr/share/applications/hplip.desktop

# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+w .

# Become your non-root user again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/hplip-*.tar.*
mv hplip-3.10.5.tar.gz installed/

# Restart CUPS, and you're done.


# WHOLE PACKAGE
# =============
# If you want to install the whole HPLIP package, continue below.

# WARNING: I have not installed the whole package in a while.  Keep this
# in mind as you continue below.

# Apply this patch to 1) make it OK if chkconfig doesn't exist (the Makefile
# blindly uses it, defined or not), 2) if /etc/init.d doesn't exist,
# use /etc/rc.d/init.d, if that doesn't exist use /etc/rc.d, and 
# 3) fix a small bug in check.py  The patch fixes Makefile.in instead of
# Makefile.am, so you don't have to run automake.
wget -nc http://englanders.us/pub/linux/patches/hplip-1.6.10.patch &&
 patch -p1 < hplip-1.6.10.patch

# Run ./check.py if you want to know what it thinks you need to have
# installed.  You'll see it complain that LSB is not installed, which is OK.
# It said PyQt wasn't installed, but after running it with -g (debug) I saw
# that it said that because it's a snapshot version.  It says
# libnetsnmp-devel is not installed, but that's because it only looks for
# net-snmp-config.h in /usr/include, mine is in /usr/local/include.
# check.py will be /usr/local/bin/hp-check after HPLIP is installed.

# If you don't have any need for network printing support (which requires
#  net-snmp), pass --disable-network-build to configure
# If you don't have any need for parallel port printing support, pass
#  --disable-pp-build to configure

# The LDFLAGS/CPPFLAGS part is because my net-snmp is linked with OpenSSL,
# which is installed under /usr/local/ssl.  Without that part, configure
# would fail saying that I don't have net-snmp in stalled.

# This is how I run configure, you may only need "./configure"
LDFLAGS=-L/usr/local/ssl/lib CPPFLAGS=-I/usr/local/ssl/include \
./configure --disable-pp-build

# Build it
make

# Become root to install it
su

# If you don't have the sysvinit-style directories set up, create them:
test -x /etc/rc.d/rc.sysvinit &&
 ( cd /etc/rc.d ; mkdir -p init.d rc{0,1,2,3,4,5,6}.d )

# Remove old packages, libraries, install the new version
test -x /sbin/removepkg && /sbin/removepkg hplip
( cd /usr/local/lib ; rm -f libhpip.* libsane-hpaio.* )
make install
ldconfig

# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+w .

# HPLIP needs to start before CUPS, so make sure that the priority number
# (the S?? symlink in /etc/rc.d/rc?.d/*) is lower for HPLIP than it is for
# CUPS.  On my system CUPS is S99 and HPLIP is S50.

# To start HPLIP (hpiod and hpssd):
/etc/rc.d/init.d/hplip start

# If you want to star the HP Device Manager GUI, run:
# /usr/local/share/hplip/toolbox
# You can use /usr/local/share/hplip/data/images/HPmenu.png for a desktop
# icon.

# Go here for installation instructions.  As it is right now, you'll want
# to check out Step 4.
# http://hplip.sourceforge.net/install/

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/hplip-*.tar.*
mv hplip-3.10.5.tar.gz installed/


# If you ever want to uninstall HPLIP, this should do it:
# ('make uninstall' by itself should do it, if you have the configure'd
# source)
cd
su
test -d src/hplip-* && ( cd src/hplip-* ; make uninstall )
test -d /etc/hp && rm -r /etc/hp
for pfx in /usr /usr/local;
do
  ( cd ${pfx}/bin ; rm -f foomatic-rip hp-mkuri hpijs )
  find ${pfx}/bin -type l -name "hp-*" -exec rm {} \;
  find ${pfx}/doc ${pfx}/share/doc -maxdepth 1 -type d \
   -name "hplip-*" -exec rm -r {} \;
  ( cd ${pfx}/lib ; rm -f libhpip.* libhpmud.* libsane-hpaio.* )
  find ${pfx}/lib/python*/site-packages -name "cupsext.*" -exec rm {} \;
  find ${pfx}/lib/python*/site-packages -name "hpmudext.*" -exec rm {} \;
  find ${pfx}/lib/python*/site-packages -name "pcardext.*" -exec rm {} \;
  test -d ${pfx}/share/cups/drv/hp && rm -r ${pfx}/share/cups/drv/hp
  test -d ${pfx}/share/hplip && rm -r ${pfx}/share/hplip
  test -d ${pfx}/share/ppd/HP && rm -r ${pfx}/share/ppd/HP
  rmdir --ignore-fail-on-non-empty ${pfx}/share/ppd
  rm -f ${pfx}/lib/cups/hpcac \
   ${pfx}/lib/cups/filter/foomatic-rip \
   ${pfx}/lib/cups/filter/foomatic-rip-hplip \
   ${pfx}/lib/cups/filter/hpcups \
   ${pfx}/lib/cups/filter/hplipjs \
   ${pfx}/lib/cups/filter/pstotiff \
   ${pfx}/lib/cups/backend/hp \
   ${pfx}/lib/cups/backend/hpfax \
   ${pfx}/lib/sane/libsane-hpaio.* \
   ${pfx}/sbin/hpiod \
   ${pfx}/share/applications/hplip.desktop \
   ${pfx}/share/cups/model/foomatic-ppds \
   ${pfx}/share/hal/fdi/preprobe/10osvendor/20-hplip-devices.fdi
done
test -d /usr/local/etc/hp && rm -r /usr/local/etc/hp
test -d /var/lib/hp && rm -r /var/lib/hp
rm -f /etc/rc.d/init.d/hplip /etc/udev/rules.d/56-hpmud_support.rules \
 /etc/xdg/autostart/hplip-systray.desktop
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "hplip-*" -exec rm -r {} \;
rm -f ~/installed/hplip-*.tar.*

Back to the list


Last updated: Wed, 29 Apr 2020 22:04:50 -0400
Jason Englander <jason at englanders dot us>