Skip to main content
LPIC-1 Exam 101

102.4 Use Debian package management

By May 28, 2013September 12th, 2022No Comments
Weight 3
Description Candidates should be able to perform package management using the Debian package tools.

Key Knowledge Areas:

  • Install, upgrade and uninstall Debian binary packages.
  • Find packages containing specific files or libraries which may or may not be installed.
  • Obtain package information like version, content, dependencies, package integrity and installation status (whether or not the package is installed).

The following is a partial list of the used files, terms and utilities:

  • /etc/apt/sources.list
  • dpkg
  • dpkg-reconfigure
  • apt-get
  • apt-cache
  • aptitude

On Debian based systems such as Debian itself and others like Ubuntu and Mint, software management comes down to .deb files and tools such as dpkg and apt-cache and apt-get . The dpkg tool manages the raw deb files and apt works with the repositories to simplify software management.

Using dpkg

If we want to work with the raw .deb files then we must download or locate the individual file and any dependencies. The following summarizes the operations:

  • -i or –install Install a .deb package
  • -r or –remove uninstalls a package but leaves the config files
  • -P or –purge will both remove the package and configurations
  • -I or –info gain information from a deb file prior to install
  • -l or –list list installed packages
  • -L or –listfiles list files from installed packages
  • -S or –search locates the owning package to a file

Use dpkg-reconfigure

Another really nice feature of the Debian system is that some packages can be configured as they are installed and even reconfigured from the command line with a text menu later. For instance,

dpkg-reconfigure tzdata

Will allow for the time zone information to be reentered or changed as required.

Use apt-cache

To start using the online repositories of DVD we can locate packages where we have the information in cache. The Debian package cache is managed using the apt-cache command. The following summarizes the sub-commands of apt-cache

  • apt-cache showpkg adobereader-enu Lists package information for the installed adobe reader.
  • apt-cache stats shows information about the amount of packages and dependencies that you have on the system.
  • apt-cache unmet shows information about packages where dependencies are not met.
  • apt-cache depends adobereader-enu shows all the dependencies for the specifies adobe reader in this case.
  • apt-cache pkgnames ad list all packages starting with the string ad.

Use apt-get

I suppose that you can say that apt-get is for installing software from software sources list in /etc/apt/sources.list . It is true it does do that but other tasks are listed here to. One important task is to update the Debian package cache

  • apt-get update updates the cache.
  • apt-get upgrade upgrades all packages or the named package if individual named.
  • apt-get install installs a named package.
  • apt-remove remove a package by name.

You may then assume it would be quite normal to run the commands in order

  1. apt-get update
  2. apt-cache search nmap
  3. sudo apt-get -y install nmap