1. Overview

HPLIP (HP Linux Imaging and Printing) is a comprehensive software suite that enables us to bridge the gap between HP devices and Linux operating systems. It acts as a crucial component for facilitating seamless printing and scanning operations for HP peripherals on Linux. This utility can be installed on all major Linux distributions.

In this tutorial, we’ll take a look at two methods that we can use to install the latest version of HPLIP on Ubuntu.

2. Automatic Installation

The first method to install HPLIP uses the automatic installer (.run file) to install the package on the machine.

To begin with, let’s go to the HPLIP download page and get the latest .run version of HPLIP.

Then, we navigate to the location that contains the newly downloaded .run file, in this case /usr:

$ cd /usr

Next, let’s launch the automatic installer by executing the .run file with sh:

$ sh hplip-3.24.4.run

Once launched, the automatic installer starts the installation process. Throughout the process, we have to answer some prompts to reach each following step.

First, we choose the installation mode. Here, let’s type a (automatic) to proceed:

Please choose the installation mode (a=automatic*, c=custom, q=quit) : a

After that, we verify the distribution and version by inserting yes:

Is "Ubuntu 22.04" your correct distribution/OS and version (yes=*, n=no, q=quit) ? yes

The next prompt wants us to read the installation notes. In this case, let’s hit Return to move on after doing so:

Please read the installation notes and hit <enter> to continue (<enter>=continue*, q=quit) :

Then, the automatic installer lists all the missing dependencies that integrate with HPLIP and starts installing them on the system:

INSTALL MISSING REQUIRED DEPENDENCIES
-------------------------------------
warning: There are 5 missing REQUIRED dependencies.
note: Installation of dependencies requires an active internet connection.
warning: Missing REQUIRED dependency: gcc (gcc - GNU Project C and C++ Compiler)
warning: Missing REQUIRED dependency: libjpeg (libjpeg - JPEG library)
warning: Missing REQUIRED dependency: cups-devel (cups-devel- Common Unix Printing System development)
warning: Missing REQUIRED dependency: libusb (libusb - USB library)
warning: Missing REQUIRED dependency: lsb (LSB - Linux Standard Base support)

Running 'sudo dpkg --configure -a'
Please wait, this may take several minutes...
Running 'sudo apt-get install --yes --force-yes -f'
Please wait, this may take several minutes...
Running 'sudo apt-get update'
Please wait, this may take several minutes...
Running 'xterm -e sudo apt-get install --yes --force-yes postfix'
Please wait, this may take several minutes...

Upon completion, we see the final step, i.e., building and installing the utility on the device:

BUILD AND INSTALL
-----------------
Running './configure --enable-network-build --disable-pp-build --enable-fax-build'
Please wait, this may take several minutes...

Command completed successfully.

Running 'make clean'
Please wait, this may take several minutes...

Command completed successfully.

Running 'make'
Please wait, this may take several minutes...

Running 'sudo make install'
Please wait, this may take several minutes...

Command completed successfully.

Once the process is done, HPLIP should be successfully installed on the machine.

3. Manual Installation

There’s also a manual way to install HPLIP on a system. Let’s go through the steps one by one.

3.1. Installing Dependencies

The first step is to install the dependencies that HPLIP requires.

To do so, we first update the package list on Ubuntu:

$ sudo apt update

Now, let’s install the dependencies:

$ sudo apt install --assume-yes libcups2 cups libcups2-dev cups-bsd cups-client avahi-utils libavahi-client-dev libavahi-core-dev \
libavahi-common-dev libcupsimage2-dev libdbus-1-dev build-essential gtk2-engines-pixbuf ghostscript openssl libjpeg-dev libatk-adaptor \
libgail-common libsnmp-dev snmp-mibs-downloader libtool libtool-bin libusb-1.0-0-dev libusb-0.1-4 wget policykit-1 policykit-1-gnome \
automake1.11 python3-dbus.mainloop.pyqt5 python3-reportlab python3-notify2 python3-pyqt5 python3-dbus python3-gi python3-lxml python3-dev \
python3-pil python-is-python3 libsane libsane-dev sane-utils xsane

The –assume-yes option answers yes to all the prompts during the procedure, ensuring a smooth installation process.

3.2. Downloading HPLIP

Firstly, let’s navigate to the HPLIP download page and download the latest .tar version of HPLIP.

Then, let’s go to the location where the .tar archive is downloaded, which is again /usr:

$ cd /usr

Next, we extract the contents of the .tar archive to the current directory:

$ tar -xf hplip-3.24.4.tar.gz

The -x option, short for –extract, extracts the contents of the archive, and the -f option, short for –file, specifies the archive that contains the files to extract.

After extraction, a new subdirectory with the contents from the .tar archive appears in the working directory.

3.3. Preparing the System for HPLIP Installation

Let’s navigate to the new path in the current directory:

$ cd hplip-3.24.4

Then, we can use the ./configure command to get the system ready for the installation:

$ ./configure --with-hpppddir=/usr/share/ppd/HP --libdir=/usr/lib64 --prefix=/usr --enable-network-build --enable-scan-build \
--enable-fax-build --enable-dbus-build --disable-qt4 --enable-qt5 --disable-class-driver --enable-doc-build --disable-policykit \
--disable-libusb01_build --disable-udev_sysfs_rules --enable-hpcups-install --disable-hpijs-install --disable-foomatic-ppd-install \
--disable-foomatic-drv-install --disable-cups-ppd-install --enable-cups-drv-install --enable-apparmor_build --enable-hplip_testing_flag
Please wait, this may take several minutes...

Command completed successfully.

The last line suggests that the machine is ready for the installation.

3.4. Installing HPLIP

The final step is to install HPLIP on the system. Before that, let’s build it by running the make command:

$ make

Next, we install the application on the device:

$ sudo make install

After completion, it can be said that HPLIP is successfully installed on the machine.

4. Conclusion

In this article, we provided a detailed explanation of the two methods that enable us to install the newest HPLIP version on Ubuntu. By following any of these methods, we can seamlessly integrate the capabilities of this software into our HP devices on the system and perform printing and scanning operations with ease.