Debian Package-Management System

Welcome to the last time you will ever have a need to install Debian from scratch. This may not seem like a rational statement, but you will agree once you understand the power in Debian’s package management system. This system combines the power, flexibility, customization, and stability all into one system.

As you read through and begin to use some of the features available, you too will agree with me that the package-management system used in Debian makes this distribution stand out among others. This unique and handy approach to managing packages led the way for other package managers.

To help users install and manage their software, packages were developed to encapsulate each application. This encapsulation makes installations much easier. One package contains all the information that a specific application needs to operate properly.

Some applications use shared resources, such as libraries that may be contained in a second package. The first package notifies the user that it depends on the second shared package, which must then be installed as well. Each application must be assembled into a package for use with the Debian package management system.

These packages are called deb packages. Their filenames end in .deb to indicate this. Over 4,000 packages are currently available from the Debian archives. When a package is installed, the package information is recorded to a database containing all the installed packages.

There are three tools that work together to install a deb package:

  • dselect - The dselect user interface provides a pseudo-graphical interface from the command line. To actually perform any management chores with this tool, it must first be executed using the root account. Once started, you have numerous options, including updating the database, selecting packages to install, installing the selected packages, and other options.
  • apt-get - The intelligent package manager—apt-get—is used in the background for dselect. This tool, when used from the command line, can retrieve a package from the Internet, along with any dependent packages (assuming the configuration specifies an Internet source). The following five commands are used with apt-get:
  • dpkg - At the heart of the package management system is the package itself. This is where dpkg comes into play. One might even say that dpkg is at the heart of Debian as well. This is because each package is nearly a self-contained application, and dpkg performs the actual installation of the package.

To install a package, use the -i or --install option. The install option is how you would install a package named myapp.deb: dpkg --install myapp.deb

You can install one or more packages using this tool by adding --recursive as an option. The --recursive option will search through any subdirectories specified and install any Debian packages found. If you have a directory (mydir) containing several packages to install, use: dpkg -install --recursive ./mydir

To extract the files of a package only, use the --unpack option. This option unpacks the files from a package, saves the configuration for the current configuration, and does not configure the new installation. When finished, the package is installed, but not configured.

To configure the package later, use the --configure option. Adding the option -a or --pending configures all unconfigured packages on the system. Because dpkg does not take into account that there might be an order to configure packages, errors may occur.

It exits after receiving 50 errors. Using -abort-after=500 tells dpkg to continue configuring until encountering 500 errors. Because dselect uses dpkg to configure the packages, it may error out before finishing configuring all packages, thus causing you to repeat the configuration a couple of times.

To remove packages with dpkg, use the -r or --remove option. This removes the packages, but leaves the configuration files behind. If you want to completely remove any trace of a package, use the --purge option. Several other options work with dpkg; you can learn more about them by reading the man pages on dpkg.