Chapter #9: Understanding Package Management in Linux
In this chapter, you'll learn how to install, update, and remove software packages in Linux using tools like apt, yum, dnf, dpkg, and rpm.

In a few words, package management is a method of installing and maintaining (which includes updating and probably removing as well) software on the system.
In the early days of Linux, programs were only distributed as source code, along with the required man pages, the necessary configuration files, and more.
Nowadays, most Linux distributors use by default prebuilt programs or sets of programs called packages, which are presented to users ready for installation on that distribution.
However, one of the wonders of Linux is still the possibility to obtain source code of a program to be studied, improved, and compiled.
How Package Management Systems Work
If a certain package requires a certain resource, such as a shared library or another package, it is said to have a dependency.
All modern package management systems provide some method of dependency resolution to ensure that when a package is installed, all of its dependencies are installed as well.
Most package managers also keep track of installed versions, verify checksums, and prevent incompatible or conflicting packages from being installed.
Packaging Systems
Almost all the software that is installed on a modern Linux system will be found on the Internet. It can either be provided by the distribution vendor through central repositories (which can contain several thousands of packages, each of which has been specifically built, tested, and maintained for the distribution) or be available in source code that can be downloaded and installed manually.
Because different distribution families use different packaging systems (Debian: *.deb
/ RHEL: *.rpm
), a package intended for one distribution will not be compatible with another distribution.
However, most distributions are likely to fall into one of the three distribution families covered by the LFCS certification.
dnf
as a replacement for yum
. Most yum
commands still work, but dnf
is the recommended tool for newer systems.High and Low-level Package Tools
In order to perform the task of package management effectively, you need to be aware that you will have available two types of utilities:
- Low-level tools, which handle in the backend the actual installation, upgrade, and removal of package files
- High-level tools, which are in charge of ensuring that the tasks of dependency resolution and metadata searching - โdata about the dataโ - are performed.
DISTRIBUTION | LOW-LEVEL TOOL | HIGH-LEVEL TOOL |
---|---|---|
Debian and derivatives | dpkg |
apt-get / aptitude |
RHEL | rpm |
yum / dnf |
apt
is an advaned another common high-level tool in modern Debian-based systems that combines features of both apt-get
and apt-cache
into a simpler interface.The most frequent tasks that you will do with low-level tools are as follows:
1. Installing a package from a compiled (*.deb
or *.rpm
) file
The downside of this installation method is that no dependency resolution is provided. You will most likely choose to install a package from a compiled file when such a package is not available in the distributionโs repositories and therefore cannot be downloaded and installed through a high-level tool.