One of the key points about how Linux distributions differ is package management. In this Linux slang explanation, you’ll learn about packaging and package managers in Linux. You’ll learn what packages are, what package managers are, how they work, and what package managers exist.

What is a package manager?

Simply put, the Package Manager package Manager (or Package Manager) is a tool that allows users to install, remove, upgrade, configure, and manage packages on the operating system. The package manager can be a graphical application like Software Center or a command-line tool like apt-get or Pacman.

You’ll find me using the word “package” a lot in tutorials and articles. To understand package managers, you must understand what packages are.

What is a bag?

A “package” (or “software package”) usually refers to an application, which can be a GUI application, a command line tool, or a software library (needed by other software programs). A package is essentially an archive file that contains binary executables, configuration files, and sometimes dependency information.

In the old days, software used to be installed from its source code. You’ll refer to a file (usually named README) to see what software components it needs and where the binaries are. It usually includes a configuration script or Makefile. You must compile the software yourself or handle all dependencies yourself (some software requires additional software installation).

To get rid of this complexity, Linux distributions have created their own packaging format that provides end-users with ready-to-use binaries (pre-compiled software) to install the software, along with some metadata (version numbers, descriptions) and dependencies.

It’s like baking a cake and buying a cake.

Around the mid-1990s, Debian created the DEB packaging format (.deb) and Red Hat Linux created the RPM (short for Red Hat Package Manager) packaging system (.rpm). The way to compile source code still exists, but it is now optional.

To interact with or use a packaging system, you need a package manager.

How does the package manager work?

Keep in mind that package manager is a generic concept and not unique to Linux. You will often find package managers for various software or programming languages. There is a PIP package manager for Python packages only. Even the Atom editor has its own package manager.

Since the focus of this article is Linux, I’ll start from a Linux perspective. However, much of the explanation here applies to package managers in general as well.

I created this diagram (based on SUSE Wiki) so you can easily understand how the package manager works.

Almost all Linux distributions have a “software Repository,” which is basically a collection of software packages. Yes, there can be more than one software library. Software libraries contain different kinds of software packages.

The software repository also has metadata files, which contain information about the software package, such as the name of the package, version number, description of the package, and the name of the software repository. This is what you see with the apt show command in Ubuntu/Debian.

The package manager on your system first interacts with the metadata. The package manager creates a local cache of metadata on your system. When you run the package manager’s update option (such as APT Update), it updates the local metadata cache by referencing metadata in the repository.

The package manager references this cache when you run the package manager’s installation commands (such as apt Install package_name). If it finds the package information in the cache, it will use the Internet to connect to the appropriate repository and download the package before installing it on your system.

A package may have dependencies. This means that it may need to install additional packages. The package manager usually handles these dependencies and installs them automatically along with the package you are installing.

Similarly, when you use the package manager to delete a package, it either automatically deletes it or notifies you that the system has unused packages to clean up.

In addition to the obvious tasks of installing and removing packages, you can use the package manager to configure packages and manage them according to your needs. For example, you can prevent upgrading a version of a package during a regular system update. Your package manager can probably do a lot more.

Different kinds of package managers

Package managers vary from package system to package system, but the same package system can have multiple package managers.

For example, RPM has Yum and DNF package managers. For debs, you have command line based package managers like apt-get, Aptitude, etc.

Package managers are not necessarily command-line based, but there are graphical package management tools such as Synaptic. Your distribution’s “software center” is also a package manager, even if it runs apt-get or DNF underneath.

conclusion

I don’t want to go into any more detail on this topic, although I could go on, but that would detract from the goal of this topic, which is to give you a basic understanding of package managers in Linux.

I’ve ignored the new generic packaging formats, such as Snap and Flatpak, for now.

I hope you have a better understanding of the package management system in Linux. If you are still confused, or if you have some questions about this topic, please comment. I’ll try to answer your questions and update this article if necessary.


Via: itsfoss.com/package-man…

By Abhishek Prakash (Lujun9972

This article is originally compiled by LCTT and released in Linux China