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 checks security updates and binary package information. This article will explore different uses of the yum command in Rocky Linux 8 and Rocky Linux 9.
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
You can display a new list of security and system updates using the’ yum’ package manager. Type the following command to perform this action:
$ yum list updates
Check updates for installed packages
The ‘yum’ command discovers 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 system. This will keep your system up-to-date. Run the below-mentioned command on the terminal:
$ yum update
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
I have updated the dnf package on my system with the above-mentioned command.
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
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
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
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*
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*
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
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, I displayed the list of dependencies for an ‘rpm’ package.
$ yum deplist rpm
Install RPM packages on Rocky Linux
You can install a specific package on your system using the’ yum’ package manager. 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 RPM packages by group on Rocky Linux
Type the following command to install a package as a group:
The following more useful commands are mentioned below in 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 9. I hope this will be useful for you and that you enjoyed this tutorial.