1. Mainpage
  2. Knowledgebase
  3. Linux Package Managers

Linux Package Managers


In this article, we will discover what package managers are and explore two of the most popular managers for Linux systems: APT (Advanced Package Tool) and YUM (Yellowdog Updater, Modified). We will study the fundamental principles of how Linux package managers work, compare their features and advantages, and consider examples of practical application, including basic commands and functions for managing packages.

Package managers are tools in operating systems designed to manage the installation, updating, and removal of software components, known as packages. Simply put, package managers help to install, delete, and update software on a computer. In the Linux operating system, package managers are particularly important as they automate the process, ensuring that all programs in the system operate together correctly and without conflicts.

APT Package Manager

General Information

APT is a package manager for Debian-based operating systems such as Debian and Ubuntu, which also includes apt-get and apt-cache. It is used for installing, removing, and managing software packages. Like any other utility on Linux, apt has an intuitive syntax:

apt command option package_name

The most common commands include:

update – refresh the package list
upgrade – upgrade installed packages
install – install new packages
remove – remove a package
purge – remove a package along with its configuration files
autoremove – remove unused packages
search – search for packages

You can obtain information about the basic commands using the help section:

APT Package Manager Help Section

Or by opening a comprehensive manual:

man apt

In the manual, you can familiarize yourself with all available commands and a detailed description of each. Example display:

APT Tool Manual for Linux

Besides basic commands, users can also utilize an additional argument – an option. Here are some of them:

-y, --yes – used to automatically confirm all prompts that APT may present
-q, --quiet – makes the output quieter, i.e., reduces the amount of information displayed on the screen
-t, --target-release – allows specifying a target operating system version for installing or updating packages
-f – forces the installation of packages, even if there are unsatisfied dependencies
-c – specifies a configuration file to use.

Examples of Use

Let's examine some of the commands and options in practice. As an example, we will use Python3. To begin, you need to update the package list:

apt update

After which, you can proceed with the installation:

apt install python3

If there is a need to remove this tool in the future, you can use the command to remove the package:

apt remove python3

Or remove the package along with its configuration files. This command completely clears the system of the package and all associated data:

apt purge python3

For daily use, it is recommended to perform updates of installed packages. This can be facilitated by the command:

apt upgrade

Equally useful is the command that removes packages installed as dependencies but are no longer needed for any package:

apt autoremove

Consider similar examples, but using options.

Automatic update of the package list:

apt-get update -y

Quiet update of all installed packages:

apt-get upgrade -q

Installing a package specifying the target version of the operating system (for example, Ubuntu 22.04):

apt-get install <package_name> -t jammy

Conclusion

In concluding the section on the APT package manager, it is worth noting both its advantages and disadvantages. The advantages include:

  1. A wide selection of packages: access to official and third-party repositories;
  2. Ease of use: intuitive commands for installation, updates, and removal;
  3. Automatic management of dependencies: resolves dependencies without user intervention;
  4. Security: uses cryptographic signatures to verify the authenticity of packages.

Among the disadvantages, it is worth mentioning:

  1. Limited support for third-party packages;
  2. Slow updates compared to some other package managers;
  3. Lack of support for some architectures.

Despite these shortcomings, APT remains one of the most popular and reliable package management tools in the Linux world, providing users with convenience and efficiency in installing and updating software.

YUM Package Manager

General Information

YUM is a package manager for the Linux operating system, developed by Red Hat for managing the installation, updating, and removal of software. It serves as the standard package management tool in distributions like RHEL, CentOS, and Fedora.

The syntax of the command is quite simple and intuitive. It mainly consists of keywords and parameters that define the action performed by the package manager. Let's examine the main commands in more detail.

Installing a package:

yum install <package_name>

Updating a package:

yum update <package_name>

Removing a package:

yum remove <package_name>

Searching for a package by keyword:

yum search <keyword>

Listing installed packages:

yum list

You can familiarize yourself with the full list of available commands in the help section:

YUM Package Manager Help Section

In addition to the standard set of commands, the tool also supports additional options and flags. Here are some examples of these parameters:

-C – use a configuration file
-q – suppress output for additional quietness
-y – disable interactivity
-v – enable verbose output
-e – enable extended output

The most common flags include:

--installroot – install packages in a specified directory
--releasever – install packages from a specified release version
--exclude – exclude specified packages from installation
--allowerasing – allow the removal of installed packages during the installation of new ones
--nogpgcheck – disable GPG checking during package installation

YUM is configured through configuration files:

  1. /etc/yum.conf – this file contains global settings for the program.
  2. /etc/yum.repos.d – this directory stores configuration files for each repository from which YUM downloads packages.

Usage Examples

Let's use Nginx as a basis for our examples. To install the package, use the command:

yum install nginx

Displaying package information:

yum info nginx
Displaying package information in YUM

Show a list of available updates for Nginx:

yum check-update nginx

Perform an update to the latest version:

yum update nginx

Remove the program from the system:

yum remove nginx

Update all installed packages with the following command:

yum update

If you only want to check for available updates without installing them:

yum check-update

Let's move on to more complex examples, involving the parameters and flags discussed earlier.

Install the nginx package without output and without confirmation, using the configuration file /etc/yum.conf:

yum -q -y -C install nginx

Update all packages, excluding the kernel, with detailed output:

yum -v --exclude=kernel update

Remove the Apache package and all its dependencies, allowing the removal of installed packages during this process:

yum -y remove httpd --allowerasing

Summary

Like any tool, YUM has its strengths and weaknesses. Its advantages include:

  1. YUM provides a simple and intuitive interface for managing packages.
  2. It automatically manages dependencies during installation or removal of packages.
  3. It allows access to centralized repositories containing thousands of ready-to-use packages.
  4. It supports an automatic update feature.

The disadvantages include:

  1. Speed. The execution time can be slow, especially when dealing with large volumes of data or slow networks.
  2. Database updates. Some operations require updating the package database, which can slow down the package management process.
  3. Limited support for package versions. YUM sometimes only offers older package versions, which can be problematic if you need the latest version of the software.
  4. Repository configuration. Sometimes setting up additional repositories is necessary to access certain packages or versions.

Overall, YUM is a powerful and convenient tool for managing packages in Red Hat-based systems, but like any software, it has advantages and disadvantages that should be considered when using it.

Package Managers Are Necessary

Both APT and YUM play an important role in managing software on Linux, providing convenient access to packages and updates. Despite differences in syntax and features, these package managers ensure efficient management of dependencies and software updates. Regardless of the choice, each package manager remains an indispensable tool for installing a variety of applications, whether Linux text editors or any other software.

Previous article Certbot: Installing Let's Encrypt Certificate
Next article What is Linux

Ask us about VPS

We are always ready to answer your questions at any time of day or night.
Please, check our Knowledge base, most likely the answer to your question is already there!