Ian Murdock, the Debian distribution’s founder, describes package management as the single biggest advancement Linux has brought to the industry. To understand package management, we have to understand how software is developed, installed and updated, why package managers are needed and how they fit into the software scene.
When software is developed, it is designed to take advantage of other components that are already available. We can use an analogy to build a house - if you own a piece of land and want to build a house, would you first build the factories that produce bricks, windows, doors, glasses, carpets, etc. or would you purchase them from the market? This is the same in building software. Suppose that you are writing a download manager. Rather than writing the download code totally from scratch, you can use the graphical components, dialogs, buttons that have been written in advance and focus yourself on the downloading process, just as you would focus on your house’s design rather than producing bricks.
Software works the same way. Developers do not need to reinvent the wheel every time they write a program. For example, what if program A depends on components X, Y, Z to run while component X depends on components U and V, component Y depends on components S and T to run, and component U depends on component T to run? The following diagram shows how the components would depend on one another.
To install program A properly, you have to install T first, then U and V, then S, then X, Y and Z and finally A. This is the only way that each component’s dependencies would be satisfied. Unless this is the case, the program will produce an error and will not be installed correctly. This is what causes “dependency hell”. Don’t think dependency hell is a Linux-only concept: it is called “Dependency Hell” in the Linux/UNIX world, “DLL Hell” in the Windows world and “Jar Hell” in the Java World.
Wouldn’t it be nice if there was a process or program that would allow you to select which program you want to install and then automate the dependency resolution? This is what package management is–a tool to resolve dependencies, install them, install the program, configure and update it. You search for the software, click to install and then let the package manager do the rest. Once you get used to it, a package manager an indispensable piece of software that lets you manage all the applications on your computer, including the operating system.
The packages, their dependencies and other related information are hosted on servers on the Internet, called repositories (or repos for short). For the sake of simplicity, you can think a repository as a pool of programs that can be reached and downloaded by a specific package manager.
Package Manager’s Jobs
As we have seen in the previous section, the package manager resolves dependencies and installs the program without any interception from the user. This is not the only thing a package manager does. It also performs the following jobs behind the scenes:
- Verify the file integrity to ensure that the downloaded package is not corrupt and is complete
- Verify the package signature to ensure that it is downloaded from a trusted repository
- Use file archivers to open the downloaded files
- Upgrade software packages from the repositories
- Group packages and present to the user in a simple, structured way (such as Games, Productivity Applications, Internet Applications, etc.)
- Resolve dependencies and make sure that the program the user requests is installed with all dependencies satisfied and in correct working state.
Main distributions have their own package managers, which we will analyze in the oncoming articles (for a quick introduction to installing and uninstalling applications in Linux, you can check our Using Applications in Linux article).
As we have stated in the beginning, package management, one of the biggest advancements in the computer industry, is an excellent way to manage software. Windows, unfortunately, has no way of a central software management except the updates. However, it is your duty as a user to watch for the updates if the program does not inform you about the updates automatically. Even if you are notified, you have to go to the manufacturer’s website, download the updated program and install it. In Linux world, you just press “Install updates” when you are informed that there are updates available for your system.
This post is part of the series: 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.