LPIC 102.4 Use Debian package management

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)

Terms and Utilities:

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

Different package management tools
Package management system provides a way for administrators to find, install, query, and remove packages.

The basic unit of Debian package is a file with a .deb extension. Use dpkg tool to install, remove and query those local .deb packages.
APT(Advanced Package Tool) handles searching remote package repositories and downloading packages. Then install downloaded package using dbkg. aptitude and synaptic are text-based and graphical interfaces layered on top of the APT tools.

dpkg tool
dpkg is a tool to install, build, remove and manage Debian packages.


  • dpkg --info package.deb
    Show information about a package
  • dpkg --install package.deb
    Install the package
Sometimes you need to install dependencies for a package. Either install the dependency first or specify all the necessary packages on the same command line:  
dpkg -i package1.deb package2.deb  
  • dpkg --remove packagename or dpkg --purge packagename
    When removes a package, specify package name without .dev extension.
    Remove a package with --purge option will clean up all configuration files as well.

force Examples:

  • dpkg --force-reinstreq packagename
    force re-install
  • dpkg --install --force-depends packagename
    force ignore dependency error
  • dpkg --install new_pkg.deb --force-conflicts
    force ignore conflict error
  • dpkg --list
    list all installed packages
  • dpkg --list http*
    list packages(installed or not installed) start with 'http'

dpkg-reconfigure reconfigures packages after they have already been installed.

  • dpkg-reconfigure postfix
    run postfix initial configuration utility again

APT tool
APT is a series of tools that build on dpkg to add more features.
Remote package repositories is stored in /etc/apt/sources.list1 and in individual files under /etc/apt/sources.list.d . Each line represents one repository.


  • apt-get install packagename
    Install a package.

    Note: apt-get commands do not have a leading dash or dashes, while dpkg does.

  • apt-get purge packagename
    remove a package with configuration files


  • apt-cache search term — Searches for packages matching the term
  • apt-cache show packagename — Shows information about a given package name including a description and dependencies
  • apt-cache showpkg packagename — Shows more technical details about the package such as what depends on it, what it depends on, and what services it provides

1. Remove onld kernels2
2. remove .deb cache
apt-get clean
3. remove unused packages
apt-get autoremove

New apt tool available
Since Ubuntu 16.04 apt is used to replace apt-get and apt-cache.