What is a package manager?
In many articles I speak about the great qualities of Package Managers, of how they can update your system with a click; install software without manually downloading, and painlessly remove them. Understanding how they work is a little and interesting piece of a puzzle filled with magic.
The first concept we come across in most of Linux distributions is package, as it sounds it means something packed up. Usually a package is composed of various things, mostly you will find binaries, source code and documentation. The concept itself is very simple: a single archive that contains the software. But packages are not only that, for example rpm packages may contain additional instructions to install the files onto the system, or to remove them, or to backup them on update. Essentially package is software (packed up).
Not every software is stand-alone (it can run on its own without another software/library installed), on Windows a remarkable example is .NET: many applications rely on this library, without it they can’t run. In Linux this concept is a bit more complicated… Many packages rely on other packages to run, and usually they require more than one package. Without those dependencies those packages will even refuse to install. Worst of all, a package is require by the package you’re trying to install, might have more packages needed and so on, creating a long chain of dependency. This was known as dependency hell. This situation was not bearable by anyone, so Package Manager Systems were invented to solve the problem.
Now that you know what a package is and what dependencies are the concept behind Package Managers should be simple. Package Managers resolve dependencies and dissolve the dependency hell. Using a Package Manager will allow a package to be installed without much effort from the user. But this is not the only good thing about package managers: they will also keep a database of installed software, much like Windows Registry. In this way every software installed is tracked, and removing it afterwards will be simpler. But one question arises: where do package comes from?
A package is essentially an archive, and obtaining it through Internet is simple. But when you use a Package Manager you won’t have to download anything manually. That’s thanks to Repositories. Repositories are essentially a storage location for packages. When you install a Linux distribution, your system will come with pre-configured repositories. Those will contain the packages appropriate for your distribution and for your package manager. Thanks to repositories you won’t have to search through the Internet to obtain packages, and that achieves also a greater security since you will obtain packages from trusted sources (repositories that come along with your distribution will usually be secure enough to be trusted).
That’s it for today. Understanding package managing is fundamental for every system administrator, and surely useful for common users trying to become superusers, in this article you’ve got a glance of what Package Managers do and what they were thought for, but there are many of them out there and commands differ a bit for each one. Fear not, basic instructions are always similar. :)
Image courtesy of Beck Gusler.