The yum and dnf package managers are used to install packages or software on your RedHat-based Linux distributions like Rocky Linux. Moreover, the ‘yum’ command is used to check security updates and binary package information. In this article, we will explore different uses of the yum command in Rocky Linux 8.

Open the terminal and log in as the root user through the terminal.

Now, you can use the yum command for the following purposes on your system:

Display a list of the latest updates in Rocky Linux

Using the ‘yum’ package manager, you can display a new list of security and system updates. Type the following command to perform this action:

$ yum list updates

Check updates for installed packages

The ‘yum’ command is used to find out new updates for already installed software and packages. The following command is used to check new updates:

$ yum check-update

Update installed packages on Rocky Linux

Using ‘yum’ command, you can download and install new updates on your CentOS 8.0. This will keep your system up-to-date. Run the below-mentioned command on the terminal:

$ yum update

Update all packages

Install Rocky Linux security updates

Using ‘yum’ command, you can install only security updates on your system. The following command is used to install security updates:

$ yum update --security

Update a specific Rocky Linux package

Using ‘yum’ command, you can update specific packages or software on your system. The syntax of this command is given below:

$ yum update {package-name-1}

Example

$ yum update dnf

Update only specific package

In the above-mentioned command, I have updated dnf package on my system.

Update a particular package version

You can update a package to a new version. First, you will display the duplicate list of the Nginx package. The syntax of this command is given below:

$ yum --showduplicates list nginx

Update package version

Now, you will update this package to the new version.

$ yum update-to nginx-version
$ yum update-to nginx-1.12.2-1.el7

Display a list of all installed packages on Rocky Linux

Using the ‘yum’ package manager, you can view the list of all installed packages on your system. Type the following command on the terminal:

$ yum list installed

List all installed packages

You can also check whether a particular package is installed or not on your system:

$ yum list installed dnf

Display a list of packages available to install

You can view the list of all packages that are available for installation. For this purpose, the following command is used:

$ yum list available
$ yum list available | more
$ yum list available | grep httdp

Packages that are available to be installed

You can try more commands related to yum list as follows:

$ yum list
$ yum list | more
$ yum list | grep bash

Search a package by name on Rocky Linux

You can find a specific package with a description through the search command. You will use the list command along with the search command.

Syntax of the yum list command

The basic syntax is given below:

$ yum list {package-name}

Example

For example, if you want to list all rpm packages then you will use the following commands:

$ yum list rpm*

Using yum list command

Syntax of the yum search command

$ yum search {package-name}

Example

For example, if you want to search all python packages then you will use the following commands:

$ yum search python
$ yum search python*

Search for packages with yum RPM package manager

How to view the details about a package

You can view all information about a specific package. The syntax is given below:

$ yum info {pkg-1} {pkg-2}

Example

For example, if you want to display all information of dnf and rpm package then the following command will be used:

$ yum info dnf

The yum info command - used to view RPM package details

Display a list of dependencies for a RPM package on Rocky Linux

You also view the list of dependencies for a package. The basic syntax is as follows:

Syntax

$ yum deplist {pkg}

Example

For example, here, I displayed the list of dependencies for an ‘rpm’ package.

$ yum deplist rpm

Show package dependencies using yum

Install RPM packages on Rocky Linux

Using the ‘yum’ package manager, you can install a specific package on your system. Use the following syntax:

$ yum install {package-name-1} {package-name-2}

For example, you can install ‘httdp’ package using the following command:

$ sudo yum install httpd

install httpd package using yum on Rocky Linux

Install RPM packages by group on Rocky Linux

Type the following command to install a package as group:

Install RPM package groups

The following more useful commands are mentioned below in the tabular form:

Yum command Purpose
$ yum localinstall {pkg} Install a package from a local file or server.
$ yum downgrade {pkg} Downgrade a package to a previous version.
$ yum reinstall {pkg} Reinstall a package or software
$ yum remove {pkg}

$ yum erase {pkg}

Remove a specific package
$ yum autoremove Auto removed unneeded packages
$ yum list all Display list of all available packages
$ yum grouplist Display group software list
$ yum groupupdate {grouppackage} Update group packages
$ yum groupremove {pkg} Remove group packages
$ yum list extras Display packages that are not available via repositories or  subscribed channels
$ yum clean all Clean cache
$ yum repolist Display list of software repositories
$ yum repoinfo {reponame} Display the information about yum enabled repositories
$ yum history or

$ yum history list

Display yum history
$ yum help install

$ man yum

$ yum help

Yum help

Conclusion

In this article, you have learned the use of different yum commands on Rocky Linux 8. I hope this would be useful for you and enjoyed this tutorial.

How to use Yum package Manager on Rocky Linux 8