YUM in Linux
Overview
Yum stands for Yellowdog Updater Modified. Yum is a command-line package management tool for Linux operating systems. It is aimed at making software installation and management easier on various Linux distributions such as CentOS, Fedora, and Red Hat Enterprise Linux.
Yum makes it simple for users to search for, install, upgrade, and delete packages from their Linux systems. It also has an easy-to-use interface for managing repositories, dependencies, and package groups. Users may use Yum to keep their software up to current and safe by swiftly installing the most recent updates and fixes.
Introduction to Yum in Linux
Yum is a powerful package management application for Various Linux distributions that automates software installation, uninstallation, and updation. It streamlines the installation process by managing dependencies and ensuring that all required packages are installed, and checking for the most latest version of the package available. This assists users in keeping their systems up-to-date and free of vulnerabilities.
Yum is a command-line tool, which means it runs from a terminal or shell. However, there are some graphical front-ends also available for Yum, like Yum Extender (yumex) and the DNFdragora.
Overall, we can say that yum is an essential tool for Linux users for managing their software packages efficiently and effectively.
How to Install Yum on Linux?
Yum is available on various Linux distributions, like RHEL, Fedora, CentOS, AlmaLinux, Rocky Linux, and more. The process of installing Yum may be different depending on the Linux distribution. Now let's discuss how to install Yum on different Linux distributions.
RHEL, Fedora, CentOS, AlmaLinux, Rocky Linux
The yum package manager is already installed by default in newer versions of RHEL-based distributions such as Fedora, CentOS, AlmaLinux, and Rocky Linux. So we can access yum using its default commands
For checking the version of yum, we can use the below command:
CentOS 7 and Older RHEL-Based Distros
Similar to RHEL-based distros, yum package manager is the default package manager for older and outdated RHEL-based distributions such as RHEL 7, CentOS 7, etc. So we can access yum using its default commands
For checking the version of yum, we can use the below command:
Ubuntu and Debian
For Ubuntu and Debian-based distributions, Yum is not available as the default package manager. However, we can install it by following the below steps:
- Open the terminal on your system.
- Run the following command to check for updates and changes in the packages:
- After that, use the following command to install dnf:
- Then install the yup compatibility layer using the following command.
- After the installation is complete, you can verify the installation by running the following command:
This will display the Yum compatibility layer version information.
Arch Linux and Manjaro
Yum is not directly available, so we can install it using the Arch User Repository. AUR helper like yay can be used for installing yum:
- Open the terminal on your system.
- After that, use the following command to install Yum:
- After the installation is complete, you can verify the installation by running the following command:
This will display the Yum version information.
Yum Command Options:
Yum package manager provides a variety of commands and options that we can use for managing packages on Linux and our Linux systems. Below are some of the most commonly used commands and options:
Option | Description |
---|---|
update | This command updates the installed packages to the latest version |
install | This command is used to install a new package or multiple packages |
remove | This command removes a package or multiple packages |
search | This command searches for packages by their name or description |
list | This command lists all the installed packages or the packages available in a repository |
info | This command is used to display information about a certain package |
clean | This command is used to clean the local repository cache |
Yum Command Basic Usage
For using the Yum command in our system, we can use the following command:
Where:
- yum is the command name
- option is an optional command-line value that modifies the behavior of the command
- command is the action to be performed (e.g. install, remove, update, etc.).
- package is the name of the package/packages to be operated on (e.g. httpd, nano, etc.)
By using the above syntax, we can use Yum as per our needs.
Managing Packages Using the Yum Command
The Yellowdog Updater Modified (YUM) is a great command-line package management tool that is used for managing packages on Linux systems, particularly Red Hat Enterprise Linux (RHEL), CentOS, Fedora, Ubuntu, Debian, and other related Linux distributions. Yum provides an easy-to-use interface for managing packages, including installing, updating, and removing packages on the system.
Now, let's see some of the examples of how can we use Yum for managing packages on our systems:
Search and Install Packages
Searching and Installing packages are one of the primary functions of the Yum package management tool. So let's see how can we search and install packages. Suppose we want to install the package named nano, but for that let's search if we have nano present in our system using the search command.
This command will search the enabled repositories for the package named nano and display the available options.
Now we can install the nano package using the install command. To install a package, you can use the yum install command followed by the package name. For example, to install the nano package, you can use the following command:
Now nano will be installed on the system using the above command:
List Information about a Package
For listing detailed information about any package, we can use the yum info command followed by the package name.
In the above examples we have installed nano editor, so let's display information about that only, you can use the following command:
This command will display information about the package like the package description, version, architecture, installed size, and dependencies.
List All Installed Packages Using Yum
There can be a case where we want to list all the packages installed on our Linux distro. So for doing that, we can use the yum list installed command. This command will display the list of all the packages that are currently installed on the system. This command is very useful in keeping track of all the packages that are installed on the system.
The command shown above will give the following output:
Remove a Package
We have talked about searching, installing, and listing the packages on our system, but there can be a case where you don't need a package anymore and maybe want to remove that package from your system. In that case, you can make use of the yum remove command. To remove a package from the system using Yum, you can use the Yum remove command followed by the package name. For example, to remove the nano package, you can use the following command:
This command will remove the nano package from the system.
For removing all the unwanted packages that were originally installed as dependencies, we can use the yum auto remove command:
This will remove all the unnecessary packages
Upgrade a Package Using the Yum Command
There can be a case in which there is an outdated package and we want to upgrade that package. In that case, we can make use of the yum command.
We can use the yum update command followed by the package name to upgrade a package to the latest version available for that package. For example, for upgrading the nano package to the latest version, we can use the following command:
This command will upgrade the nano package to the latest version available in the enabled repositories.
For upgrading all the available packages we can use the upgrade command only:
This will upgrade all the available packages to the late versions:
Search and Install Package Groups
Package groups are like multiple packages combined to make a single group name. These package groups can be Server GUI, Admin Tools, Package Tools, etc. For seeing all the available groups, use the group list command:
This will list all the available groups:
Yum also provides us the ability for installing a group of packages at once using the yum group install command. To install a package group, you can use the following command:
For example, we need to install the Administration Tools package group, you can use the following command:
The above command will install all the packages included in the Administration Tools package group:
List Available or Enabled Repositories
We can use the yum repolist all command to list all the available repositories on the system. Using this command we can display a list of available repositories, their status, and the number of packages available in each repository.
All the available repos will be displayed in following the ng format:
For listing all the enabled repositories, we can use the yum repolist enabled command:
List Dependencies of a Package
We can use the yum deplist command followed by the package name to display all the available dependencies of a package. Let's extend the above examples to display the dependencies of the nano package, you can use the following command:
The above command will display a list of dependencies required by the nano package, this includes all the packages that must be installed to satisfy those dependencies.
View History of Installation/Removal of Packages
We can also view the history of Yum installations and removals using the history command:
This command will display the yum history of actions done:
Conclusion:
- In this article, we learned everything about yum in Linux.
- We learned about the basic definition of yum in Linux.
- We learned how to install yum in different Linux systems.
- Then we learned what the command options are provided by yum in Linux.
- We understood the basic syntax usage of Yum in linx
- Then we looked at some examples of managing packages using the yum command like:
- Searching and Installing packages using Yum.
- List information about a package
- List all installed packages using yum
- Remove a package using yum
- Upgrading a package using the yum
- Searching and Installing package groups using Yum
- List available or enabled repositories
- List dependencies of a package
- View History of Installation/Removal of packages