Top.Mail.Ru

Understanding what a package manager is in Linux

Understanding what a package manager is in Linux

One of the main differences between Linux distributions is the way they install and update programs. The package management system and a special utility, the package manager, are responsible for this.

Without further ado, a package manager is a program manager on your system. Through it, you install new applications, update already installed ones, and delete what you no longer use. There you can also manage package versions and their settings.

A package manager can look different. In one case it is a graphical interface like the application center, in the other it is a console program like apt, dnf or pacman. 

Screenshot 20251124 182232

The idea is the same for everyone: take the required package from the repository, install it correctly into the system and follow the updates.

What happened before package managers?

Initially, programs on Linux and Unix systems were usually installed from source code. You downloaded the archive, unpacked it, opened README or INSTALL, found out what libraries were needed, what commands needed to be run, and where everything would eventually be installed.

Most often, the source directory contained a configure script or a Makefile. Next came manual assembly: first you dealt with the dependencies, then compiled the program itself, and only then could you run it.

This approach provided flexibility, but required a lot of time and a good understanding of the system. To make life easier for users, distribution developers came up with the idea of ​​storing programs in the form of ready-made packages: they are compiled once, packaged along with metadata, and posted in a repository. 

The difference is about the same as between buying a cake from the supermarket and making it yourself according to the recipe. 

The user gets the opportunity to install everything with one command, without delving into the intricacies of the assembly. 

The idea of ​​a package manager has long gone beyond operating systems. Programming languages ​​have a similar logic: Python uses pip, Node.js has npm And yarn. Even individual programs can have their own plugin managers: for example, the Atom editor installs plugins through its own package mechanism.

How does a package manager work in Linux?

Each distribution has one or more repositories — remote servers with packages. There are not only the archives themselves, but also detailed information about each package: name, version, description, list of dependencies and other service data.

When you request information about a package, for example with the apt show package_name command, the package manager accesses this metadata.

In order not to pull data from the server every time, the manager creates a local cache. A command like apt update updates this cache: the system connects to the repositories, gets the latest lists of packages and their versions, and saves them to disk. Thanks to this, searching and installation are then carried out faster — the information is already at hand.

When you run apt install package_name several steps happen at once. First, the manager looks in the local cache to make sure that the package exists and to find out the current version. Then it analyzes the dependencies and generates an installation plan: which archives need to be downloaded, in what order to install them, and whether they conflict with already installed programs. Only after this does the downloading and unpacking of files begin, placing them in the required system directories.

Much of this work is hidden from the user. You see only a list of packages and a progress bar, while inside at this moment dependencies are maintained, databases are updated, paths and access rights are configured.

Dependencies and «extra» packages

Almost every application relies on other libraries and components. The package manager takes this into account and automatically pulls up everything you need during installation. If a program requires five additional packages, they will be installed along with it—you don’t have to select them manually.

When you uninstall a program, some dependencies may remain on the system if other packages use them. But if some components are no longer needed by anyone, many managers can either automatically remove them, or at least report that unused packages have appeared in the system that can be safely removed.

What else can a package manager do?

Installation and removal are not the only tasks. Depending on the specific tool, you can, for example, prevent updating a certain package if you want to keep the current version, or tie the program to a specific branch — stable, testing or experimental.

Package managers also help restore damaged packages, reinstall them over an existing version, and carefully carry out mass system updates, minimizing the risk of conflicts.

Different managers for different distributions

The set of tools depends on the distribution and the package format used. In RPM systems, yum was the main one for a long time, later dnf took its place. In Debian and Ubuntu, apt, apt-get, aptitude and other console utilities are used to work with .deb packages.

A separate group is graphic managers. In the Debian ecosystem, Synaptic has long been a popular example. Modern application centers in distributions are essentially the same package managers, only with a convenient visual interface. Inside, they still use system utilities, they simply hide commands and options from the user.

Conclusion

The topic of package managers in Linux is extensive: different distributions, their own tools, features of working with repositories and dependencies. All this can easily be turned into a separate book.

Something else is more important here—a common understanding. A package in Linux is a packaged program with metadata and dependencies. A package manager is a tool that can find these packages in repositories, install them, update them and remove them, while ensuring that the system remains intact and operational.

We deliberately did not touch on universal formats like Snap and Flatpak — they have their own approach and their own characteristics. But now you have the basis to understand what exactly happens in the system when you install a program with one command or one click.

CONTENT:

Similar

All news

Похожее

Все новости

Adaxa Suite: подробный обзор ERP-системы корпоративного класса

Adaxa Suite — комплексная ERP-платформа для компаний, которым уже тесно в рамках простых учётных систем, но которые при этом не готовы идти в сторону дорогих корпоративных решений уровня SAP или Oracle. Изначально продукт создавался для среднего бизнеса, которому нужна большой набор функций, сквозная автоматизация процессов и надёжная архитектура без чрезмерной стоимости владения. Архитектура и техническая […]

Как заказать дополнительные IP-адреса на UFO.Hosting: пошаговая инструкция

По мере роста проекта одного IP-адреса может стать недостаточно. Это типичная ситуация для компаний, которые масштабируют инфраструктуру, запускают новые сервисы или разделяют внутренние процессы. В UFO.Hosting подключение дополнительных IP-адресов выполняется через биллинговую панель и занимает всего несколько минут. Важно: возможность для заказа дополнительных IP-адресов доступна для тарифов VPS начиная с Haedus. Зачем нужны дополнительные IP-адреса […]