8.2.2. Installing Packages
Thanks to the thoughtful design of the Debian package system, you can install packages, with or
without their dependencies, fairly easily. Let’s take a look at package installation with
dpkg
and
apt
.
Installing Packages with
dpkg
dpkg
is the core tool that you will use (either directly or indirectly through APT) when you need
to install a package. It is also a go-to choice if you are operating offline, since it doesn’t require an
Internet connection. Remember,
dpkg
will not install any dependencies that the package might
require. To install a package with
dpkg
, simply provide the -i or --install option and the path to
the
.deb
. This implies that you have previously downloaded (or obtained in some other way) the
.deb
file of the package to install.
#
dpkg -i man-db_2.9.3-2_amd64.deb
(Reading database ... 309317 files and directories currently installed.)
Preparing to unpack man-db_2.9.3-2_amd64.deb ...
Unpacking man-db (2.9.3-2) over (2.9.3-2) ...
Setting up man-db (2.9.3-2) ...
Updating database of manual pages ...
man-db.service is a disabled or a static unit not running, not starting it.
Processing triggers for kali-menu (2020.4.0) ...
Processing triggers for mime-support (3.64) ...
We can see the different steps performed by
dpkg
and can see at what point any error may have
occurred. The -i or --install option performs two steps automatically: it unpacks the package and
runs the configuration scripts. You can perform these two steps independently (as apt does behind
the scenes) with the --unpack and --configure options, respectively:
#
dpkg --unpack man-db_2.9.3-2_amd64.deb
(Reading database ... 309317 files and directories currently installed.)
Preparing to unpack man-db_2.9.3-2_amd64.deb ...
Unpacking man-db (2.9.3-2) over (2.9.3-2) ...
Processing triggers for kali-menu (2020.4.0) ...
Processing triggers for mime-support (3.64) ...
#
dpkg --configure man-db
Setting up man-db (2.9.3-2) ...
Updating database of manual pages ...
Note that the “Processing triggers” lines refer to code that is automatically executed whenever a
package adds, removes, or modifies files in some monitored directories. For instance, the
mime-