yum is an interactive, rpm-based package manager. It can automatically perform system updates, including dependency analysis and obsolete processing based on repository metadata. It can also perform installation of new packages, removal of old packages and perform queries on the installed and/or available packages among many other commands/services.
yum is configured in /etc/yum.conf.
The configuration file contains, among other things, the location of the log file (by default /var/log/yum.log).
yum looks for local repository definitions. More details are found in the Yum Repositories section
Installation on RHEL8
Yum looks into local repository definitions, which are .repo files kept in /etc/yum.repos.d/. All files with the .repo file extension in this directory are read by yum. More information about configured repository can be obtained with yum repolist.
To query the content of a specific repository, use yum repository-packages.
To install a new repository, see Adding a Repository Definition below.
Yum supports a series of built-in variables, which can be used in all its configuration files, including repository definitions:
This variable references the release version of Red Hat Enterprise Linux. Yum obtains the value of $releasever from the distroverpkg=value line in the /etc/yum.conf configuration file. If there is no such line in /etc/yum.conf, then yum infers the correct value by deriving the version number from the redhat-releaseproduct package that provides the redhat-release file.
Yum can be configured to exclude packages from updates to prevent accidental upgrades when we don't want to upgrade, by adding package names to the "exclude" directive in /etc/yum.conf.
exclude= tuned-profiles-atomic-openshift-node atomic-openshift-tests atomic-openshift-sdn-ovs atomic-openshift-recycle atomic-openshift-pod atomic-openshift-node atomic-openshift-master atomic-openshift-dockerregistry atomic-openshift-clients-redistributable atomic-openshift-clients atomic-openshift docker*1.20* docker*1.19* docker*1.18* docker*1.17* docker*1.16* docker*1.15* docker*1.14* docker*1.13*
Used to list various information about available packages - packages available from the repositories described in /etc/yum.repos.d/*.repo.
Gets a list of installed packages:
yum list installed
To filter, use | grep:
yum list installed | grep [-i] <package-name>
Example of positive hit:
[root@ns ~]# yum list installed | grep [-i] httpd httpd.x86_64 2.4.6-40.el7 @rhel-7-server-rpms httpd-tools.x86_64 2.4.6-40.el7 @rhel-7-server-rpms
Gets a list of all packages in all available repositories.
yum list available
To filter, use | grep.
Without arguments, the command lists all packages available from all installed repositories:
To get information about a specific package:
yum info <package-name>
This can be used for information on packages that already have been installed or on package that has't been installed yet. If the package has been installed, yum info will report Installed Packages, otherwise will say Available.
Displays information about configured repositories - repositories described in /etc/yum.repos.d/*.repo files.
yum repolist [-v] [repository-id]
where "repository-id" is the repository identifier declared between square brackets in the .repo file.
yum search <string>
"provides" can be used to find packages that might contain a certain command:
yum provides sealert
yum repository-packages dockerrepo list
yum repository-packages dockerrepo info
Installs the specified package.
yum install <package-name>
Updates the specified package.
yum update <package-name>
To update all packages, see "Update All Packages"
remove and erase are equivalent.
Removes the specified package and its dependents from the system.
yum remove <package-name>
Remove cached data.
yum clean all
Update All Packages
yum -y update
Adding a Repository Definition
yum install yum-utils