What is a Package Manager?
A package manager is a software application that is used to install, upgrade, configure and uninstall programs from a computer. For example, you want to install application X, which depends on the applications A, B and C to run. Application C also depends on A to run and in turn, A depends on B to run. So, you have to install B, A, C (in this order) and when everything is complete you can finally install X. In the end this is far too complicated for the average user (that’s why this is called “dependency hell” in Linux jargon). This is where package managers come in taking care of all dependencies for the user. In a Debian-based distribution apt-get install x or in a Red Hat based distribution yum install x installs program X by downloading and installing all the dependencies.
Good enough? Yes and No.
Package managers download applications from the distribution’s online “repositories”. A repository is a location (on the Internet, on the CD/DVD or on the user’s computer) from which the applications can be retrieved and installed. If a particular program is not available from the distribution’s repository, the user can add another repository from which he can retrieve the package he wants. The package manager, in our example above, can retrieve the application X from the added repository, say Repo 2, but A, B and C from the distribution’s repository Repo 1.
All the package managers do their jobs well but sometimes problems arise due to a number of factors.
- Naming differences in the repositories. For example A is listed as A.1 in a repository and the package manager is not able to find and download application A.
- Binary packages are not immediately available on the repositories.
- The repositories do not “talk” to each other and packages cause conflicts.
As we know, the programmers release the software they develop as source code, in most cases in tar.gz or tar.bz2 formats. The “packaging” process involves retrieving these files and writing scripts for the package manager to download and install the dependencies. So, human error can be added to our list above.
The Perfect Package Manager
OK, tastes differ and I do not want to start a flamewar here. That being said, you may love Debian’s packaging format .deb, you may love .rpm, you may love .pet but there are two other package managers I would like to discuss: PISI of Pardus and Portage of Gentoo.
There are many issues addressed by these two package managers.
- Portage downloads the source code from its repository and compiles everything from source. This makes the installation process slower but the resulting package is optimized for the system it is compiled on. This process also streamlines the process of adding new programs to the Portage Repository.
- PISI (an abbreviation of Packages Installed Successfully as Intended) uses the successful LZMA compression and during updates it only downloads the parts of the program that has changed. This conserves bandwidth, disk space and time. Package maintenance is so easy that even a non-programmer (such as me) can edit a template XML file and make a PISI package.
I believe the best package manager would be a combination of these two and would have to be distribution independent. Currently there are a couple projects who are focusing on creating a “distribution-free” package manager in line with this idea. In theory these package managers will not rely on either rpm, deb or any other package format. In my opinion this will benefit Linux users in general by giving users the option of compiling programs from source or using pre-compiled packages as well as removing the need to learn each distribution’s package management system.
In the last installment of this series we will bring all these aspects of distribution creation together and discuss if the perfect Linux distribution is indeed a realistic goal.
This post is part of the series: The Perfect Linux
As far as operating systems go, Linux is about as perfect as you get. In this series of articles we will discuss what makes a Linux application, package manager, and overall distribution perfect.