Previous Chapter - Table of Contents - Next Chapter
Debian Package Manager (DPKG) used by all Debian-based distributions to control installation, verification, upgrade, removal of software on Linux systems. Low-level dpkg program can perform all operations, either on just one package, or on list of packages. Operations which cause problems (eg. removing package that another package depends on, installing package when system needs other software to be installed first) blocked from completion.
- Discuss the DPKG packaging system and its uses.
- Explain the naming conventions used for both binary and source deb files.
- Know what source packages look like.
- Use querying and verifying operations on packages.
- Install, upgrade, and uninstall Debian packages.
DPKG (Debian Package): packaging system used to install, remove, manage software packages under Debian Linux and other derived distributions. Like RPM, not designed to directly retrieve packages in day-today use, but to install and remove them locally.
Package files have .deb suffix and DPKG database resides in /var/lib/dpkg directory.
like rpm, dpkg program has only partial view of universe: knows only what is installed on system, whatever given on command line, knows nothing of other available packages (whether they are in other directory on system or out on Internet). Will also fail if dependency not met, or if trying to remove package other installed packages need.
Debian package file names based on fields that represent specific information. Standard naming format for binary package:
<name>_<version>-<revision_number>_<architecture>.deb
as in:
logrotate_3.8.7-1_amd64.deb
on Debian, and
logrotate_3.8.7-1ubuntu1_amd64.deb
on Ubuntu.
Note: for historical reasons, 64-bit x86 platform called amd64 rather than x86-64, and distributors (eg. Ubuntu) insert their name in package name.
In Debian packaging system, source package consists of at least three files:
- Upstream tarball, ending with
.tar.gz. Unmodified source as it comes from package maintainers - Description file, ending with
.dsc, containing package name and other metadata, eg. architecture, dependencies - Second tarball containing any patches to upstream source + additional files created for package. Ends with name
.debian.tar.gzor.diff.gzdepending on distribution
Eg. on Ubuntu system, can download source package, then see what files downloaded or created:

Some examples of queriesL
-
List all packages installed:
$ dpkg -l
One can also specify a package name.
-
List files installed in
wgetpackage:$ dpkg -L wget
-
Show info about an installed package:
$ dpkg -s wget
-
Show info about a package file:
$ dpkg -I webfs_1.21+ds1-8_amd64.deb
-
List files in a package file:
$ dpkg -c webfs_1.21+ds1-8_amd64.deb
-
Show what package owns
/etc/init/networking.conf:$ dpkg -S /etc/init/networking.conf
-
Show the status of a package:
$ dpkg -s wget
-
Verify the installed package's integrity:
$ dpkg -V package
Without arguments, this will verify all packages on system. See man page to interpret output. Note: only recent versions of dpkg (1.17+) support this option.
$ sudo dpkg -i foobar.debwould be used for either installing/upgrading foobar package.
If package not currently installed, then will be installed. If package newer than one currently installed, then will be upgraded.
$ sudo dpkg -r packageused to remove all of installed package except for configuration files.
$ sudo dpkg -P packageused to remove all of installed package including configuration files (Note: -P stands for purge).