Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions about the management of software packages, in particular the APT and dpkg systems.

A package management system allows users to install, update, remove and get information about software installed on a system. Since many programs use shared libraries, a key task of package management is to resolve dependencies so that when the user installs a package any dependencies are pulled in too, and that when a package is removed, packages that depend on it are removed to prevent them from breaking.

The need for a package management system arises from the dynamic software landscape of the Linux world, allowing users to benefit from the active development of applications from many sources. It also provides security since signed packages downloaded from repositories are automatically checked against keys on the local system.

Ubuntu has inherited Debian's package management system, consisting of dpkg, a lower-level utility that installs and removes packages and checks dependencies at install time, and APT (Advanced Package Tool) which fully resolves dependencies by finding the needed packages, and fetches updates. Users can use apt and dpkg commands to query and update the database of software available in repositories and installed on the system, to install or remove software and upgrade installed packages, and clean up obsolete programs. Graphical front-ends for the APT system are also present in all versions and flavors of Ubuntu.

In additional to using Ubuntu repositories, APT can manage software from external repositories added by users such as PPAs. Normally, Ubuntu repositories are specified in /etc/apt/sources.list and external sources in files in /etc/apt/sources.list.d

Users may also install .deb packages from other sources using dpkg and its graphical front-end Gdebi.

Software may also be compiled from source. Developers generally provide scripts with the source code to set up a build environment checking for dependencies (which the user has to resolve by installing more packages), but after installation the package will not be known to dpkg, so must be maintained, updated and removed by the user. The same is true for precompiled binaries or scripts placed in the system by the user directly.

Resolving dependencies is always a challenge. In 16.04 Ubuntu has introduced an innovation, snap packages, which bypass the problem entirely; instead of using shared libraries, they are packaged and installed with all their dependencies included. Using shared libraries is more efficient in terms of storage, so snaps take up more space.

For more information see the Debian wiki package management section and links there to the Debian Reference Manual.