One of the main points where Linux distributions differ from each other is package management. In this part of the Linux jargon buster series, you will learn about package and package managers in Linux. You will learn what packages are, what are and how package managers work and what types of package managers are available.
What is a package manager in Linux?
In simpler terms, a package manager is a tool that allows users to install, remove, upgrade, configure, and manage software packages on an operating system. The package manager can be a graphical application like a software center or a command line tool like apt-get or pacman.
You will often find me using the term “package” in tutorials and articles on It’s FOSS. To understand the Package Manager, you need to understand what a package is.
What is a package?
A package usually refers to an application, but it can be a graphical application, a command line tool, or a software library (required by other software). A package is basically an archive file containing the binary executable, the configuration file, and sometimes dependency information.
In the past, software was installed from its source code. You would refer to a file (usually named readme) and see what software components it needs, the location of the binaries. Often a configuration script or makefile is included. You will need to compile the software or yourself and manage all dependencies yourself (some software requires installation of other software).
To get rid of this complexity, Linux distributions have created their own packaging format to provide end users with ready-made binaries (precompiled software) for software installation as well as metadata (version number, description) and dependencies.
It’s like baking a cake instead of buying a cake.
In the mid-1990s, Debian created the .deb or DEB packaging format, and Red Hat Linux created the .rpm or RPM (short for Red Hat Package Manager) packaging system. Compiling the source code still exists, but is now optional.
To interact with or use packaging systems, you need a package manager.
How does the package manager work?
Please keep in mind that the package manager is a generic concept and is not exclusive to Linux. You will often find a package manager for different software or programming languages. There is a PIP package manager only for Python packages. Even the Atom publisher has its own package manager.
Since this article focuses on Linux, I’ll take it from a Linux perspective. However, most of the explanations here could also apply to the package manager in general.
I created this diagram (based on SUSE Wiki) so that you can easily understand how a package manager works.
Almost all Linux distributions have software repositories which are basically a collection of software packages. Yes, there can be multiple repositories. Repositories contain software packages of different types.
Repositories also have metadata files that contain information about packages such as package name, version number, package description and repository name, etc. This is what you see if you use the apt show command in Ubuntu / Debian.
Your system’s package manager first interacts with the metadata. The Package Manager creates a local metadata cache on your system. When you run the update option of the Package Manager (e.g. apt update), it updates this local metadata cache by referring to the repository metadata.
When you run the install command from your package manager (for example apt install package_name), the package manager refers to this cache. If it finds the package information in the cache, it uses the Internet connection to connect to the appropriate repository and downloads the package before installing it on your system.
A package can have dependencies. This means that it may require the installation of other packages. The Package Manager often takes care of dependencies and automatically installs it with the package you are installing.
Likewise, when you remove a package using Package Manager, it automatically removes or notifies you that your system contains unused packages that can be cleaned up.
Besides the obvious installation and removal tasks, you can use the Package Manager to configure the packages and manage them as needed. For example, you can prevent the upgrade of a package version from regular system updates. There is a lot more that your package manager could be capable of.
Different types of package managers
Package managers differ depending on the packaging system, but the same packaging system can have multiple package managers.
For example, RPM has Yum and DNF package managers. For DEB, you have apt-get, the aptitude command line-based package managers.
Package managers are not necessarily command line based. You have tools for managing graphics packages like Synaptic. Your distro’s software center is also a package manager even though it runs apt-get or DNF below.
I don’t want to go into more detail on this topic because I can go on and on. But this will deviate from the purpose of the topic which is to give you a basic understanding of Linux package manager.
I have omitted the new universal packaging formats like Snap and Flatpak for now.
Hope you understand Linux package management system a little better. If you are still confused or have any questions about this, please use the feedback system. I will try to answer your questions and if necessary update this article with new points.