/
/
Packet management in Linux

Packet management in Linux

Why?

Understanding how to manage Linux packages using APT, YUM, and DNF is a key skill for system administrators and developers who use a Linux environment. It allows you to manage your installation, upgrade, or remove packages and their dependencies, ensuring that the operating system and applications function properly.

Knowledge of these tools also helps with system upgrades, managing package repositories, and software security.

TAKE NOTE!

Be careful when changing system repositories and connecting third-party repositories – such changes may cause errors when updating the ispmanager panel or installing software through the panel.

Instructions

Package management with APT

APT (Advanced Package Tool) is a package management tool that is used in most Debian- and Ubuntu-based distributions.

Basic apt commands:

  • apt update - Updates the list of available packages from the repositories.
  • apt upgrade - Updates all installed packages to the latest versions.
  • apt install <package name> - Installs or updates a specified package from the repositories.
  • apt remove <package name> - Removes the specified package, leaving the configuration files.
  • apt purge <package name> - Removes the specified package, removing all configuration files.
  • apt search <keyword> - Searches the repositories for packages by keyword.
  • apt show <package name> - Shows detailed information about a package.
  • apt --reinstall install <package name> - Reinstalls an already installed package.
  • UCF_FORCE_CONFFMISS=1 apt-get --reinstall install <package name> - Reinstall a package and restore the configuration files if "--reinstall" did not work.

The "UCF_FORCE_CONFFMISS=1" part of the command sets the "UCF_FORCE_CONFFMISS" environment variable to "1", which tells the program "ucf" to ignore changes to configuration files and accept them by default if they don't exist.

To manage repositories in Debian and Ubuntu, use the main file "/etc/apt/sources.list" and the files in the directory "/etc/apt/sources.list.d/" - they contain information about the repositories from which APT installs packages.

You can create new ".list" files to add new repositories, or edit the existing files to change the current repositories.

Package management with YUM

YUM (Yellowdog Updater, Modified) is a package management tool used in CentOS, AlmaLinux, Fedora, and other RedHat-based distributions.

The basic YUM commands are:

  • yum update - Updates all installed packages to the latest versions from the repositories.
  • yum install <package name> - Installs the specified package from the repositories.
  • yum remove <package name> - Removes the specified package.
  • yum search <keyword> - Searches the repositories for packages by keyword.
  • yum info <package name> - Shows detailed information about the package.
  • yum history - This command provides the ability to view a list of package transactions on the system including installation, upgrade, and uninstallation.
  • yum history info <id or package name> - Shows a detailed history of the package manager command number or displays the history of the specified package.
  • yumdownloader -q --urls <package name> - Used to retrieve URLs for downloading a package (repositories), but without actually downloading the package itself.

In Red Hat distributions, repository files are usually located in the "/etc/yum.repos.d/" directory.

You can create new files with the extension ".repo" to add new repositories, or edit existing files to modify the current repositories.

Package management with DNF

DNF (Dandified YUM) is a next-generation package management tool that provides a faster and more modern approach to package management in Red Hat-based distributions.

Although DNF provides similar features as YUM, it has a number of additional features and enhancements.

Some basic DNF commands are:

  • dnf upgrade - Upgrades all installed packages to the latest versions from the repositories.
  • dnf install <package name> - Installs the specified package from the repositories.
  • dnf remove <package name> - Removes the specified package.
  • dnf search <keyword> - Searches the repositories for packages by keyword.
  • dnf info <package name> - Displays detailed information about the package.

In distributions that use DNF, the repository configuration files are usually located in the directory "/etc/yum.repos.d/", similar to YUM.

You can modify or add files with the ".repo" extension in this directory to configure access to different repositories.

DNF offers a more modern and efficient way to manage packages on Red Hat-based systems, while retaining the convenience and reliability of YUM. Using DNF is recommended for more up-to-date versions of Linux distributions such as AlmaLinux.