APT (Advanced Packaging Tool) is a high-level package management tool used in Debian-based Linux distributions. In this article we review APT in detail.
Debians distribution base of the package management process is called dpkg, which stands for Debian PacKaGe. Debian-native applications have the .deb extension and dpkg is used to install, remove and provide information to the deb packages on a Debian-based system. In this manner, dpkg is a low-level utility.
Thus, with the advancement of software distribution processes through on-line repositories, together with complex dependency resolution process requirements, a higher-level tool was needed. One which could deal with downloading the packages from remote locations (on-line repositories) and be user friendly. At this point, the Debian community came up with apt, the abbreviation of Advanced Packaging Tool.
apt is not a single program, but rather the name of the package that contains the necessary set of tools to enable the user to download packages from a repository and install them. With these tools, you can apt-get install application_name to download packages and install from the Internet, you can apt-get update to update the packages on your system, apt-get distro-upgrade to upgrade your distribution to the new release, apt-cache search package_name to search for a specific package in the repositories or apt-get remove package_name to remove a specific package etc.
When you want to install an application with the command apt-get install application_name, you very basically trigger the following events:
- Make apt search for the package in the repository,
- If the package is found, check if it is already installed,
- If not, check the dependencies,
- Check if any, some, or all of the dependencies are already installed,
- If not, download the missing dependencies in the order that they will be installed by considering their own set of dependencies,
- Invoke dpkg in such a way that the dependencies are installed first and the application last.
apt Files and Folders
apt uses many files and folders during operation. The main files and folders are as follows:
- /etc/apt/sources.list: The file that contains the path (and URL) of the repositories,
- /etc/apt/sources.list.d: The folder that contains the files, which contain paths (and URLs) of additional repositories,
- /etc/apt/apt.conf or /etc/apt/apt-file.conf: The file that contains the apt configuration,
- /etc/apt/apt.conf.d: The folder that contains additional apt configuration,
- /etc/apt/preferences: The file that contains apt preferences,
- /var/cache/apt/archives: The folder that contains the files apt has downloaded,
- /var/cache/apt/apt-file: The folder that contains the files which maps each file available in the Ubuntu Linux system to the package from which it originates,
- /var/lib/apt/lists: The folder that contains the state information for each package resource specified in the sources.list file,
- /var/lib/apt/keyring: The folder that holds the GPG keyrings,
- /var/lib/apt/periodic: The folder that holds the “update" and “update successful" stamp files.
As you would expect, there are graphical front ends to apt, saving you from typing and issuing commands. These graphical front ends make the users' lives easier by presenting detailed information about the packages. Here is a list of well-known apt graphical user interfaces:
- Aptitude: This is a curses-based front end to apt.
- Synaptic: The most famous Gnome front end to apt, shows packages in groups, lets the user search for packages and can download screenshots.
- Adept: The add/remove package application. It presents the packages in groups and lets the user see the community popularity of the applications.
- Kpackage: A KDE front-end to apt. It is very similar to Synaptic with a slightly different view.
apt is one of the most powerful (in my personal opinion THE most powerful) package manager in the Linux world. Although I have never seen an analysis on this, the power of the package management is perhaps the reason why Debian is the distribution that has so many derivatives compared to other Linux distributions. Behind the scenes there are very strict rules for packaging and very strict rules to accept packages to the repositories. The package manager works on top of these rules and does a fantastic job. It's been three years and I haven't seen a broken package or an unresolved dependency.
Linux Package Management
In our series about the package management process in Linux, we will start from scratch, talk about the software packages, the dependencies, their resolutions and then analyze the package management systems of the mainstream Linux distributions.
- Understanding Package Management
- Debian's APT - Top Package Management
- Red Hat's RPM
- Slackware's Pkgtool and Slackpkg
- Pardus's PISI