Product SiteDocumentation Site

1.3. Configuring Yum and Yum Repositories

This section shows you how to:
The /etc/yum.conf configuration file contains one mandatory [main] section under which you can set Yum options. The values that you define in the [main] section of yum.conf have global effect, and may override values set any individual [repository] sections. You can also add [repository] sections to /etc/yum.conf; however, best practice is to define individual repositories in new or existing .repo files in the /etc/yum.repos.d/directory. Refer to Section 1.3.2, “Setting [repository] Options” if you need to add or edit repository-specific information.

1.3.1. Setting [main] Options

The /etc/yum.conf configuration file contains exactly one [main] section. You can add many additional options under the [main] section heading in /etc/yum.conf. Some of the key-value pairs in the [main] section affect how yum operates; others affect how Yum treats repositories. The best source of information for all Yum options is in the [main] OPTIONS and [repository] OPTIONS sections of man yum.conf.
Here is a sample /etc/yum.conf configuration file:
[comments abridged]
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d

Here is a list of the most commonly-used options in the [main] section, and descriptions for each:
This option specifies the directory where Yum should store its cache and database files. By default, Yum's cache directory is cachedir=cachedir=/var/cache/yum/$basearch/$releasever . See Section 1.3.3, “Using Yum Variables” for descriptions of the $basearch and $releasever Yum variables.
keepcache=<1 or 0>
Setting keepcache=1 instructs yum to keep the cache of headers and packages after a successful installation. keepcache=1 is the default.
reposdir=<absolute path to directory of .repo files>
This option allows you to specify a directory where .repo files are located. .repo files contain repository information (similar to the [repository] section(s) of /etc/yum.conf). yum collects all repository information from .repo files and the [repository] section of the /etc/yum.conf file to create a master list of repositories to use for transactions. Refer to Section 1.3.2, “Setting [repository] Options” for more information about options you can use for both the [repository] section and .repo files. If reposdir is not set, yum uses the default directory /etc/yum.repos.d/.
gpgcheck=<1 or 0>
This enables or disables GPG signature checking on packages in all repositories, including local package installation. The default is gpgcheck=0, which disables GPG-checking. If this option is set in the [main] section of the /etc/yum.conf file, it sets the GPG-checking rule for all repositories. However, you can also set this on individual repositories instead; i.e., you can enable GPG-checking on one repository while disabling it on another. Setting gpgcheck= for individual repositories overrides the default if it is present in /etc/yum.conf. Refer to Section 3.3, “Checking a Package's Signature” for further information on GPG signature-checking.
assumeyes=<1 or 0>
This determines whether or not yum should prompt for confirmation of critical actions. The default is assumeyes=0, which means yum will prompt you for confirmation. If assumeyes=1 is set, yum behaves in the same way that the command line option -y does.
exclude="<package_name> [more_names]"
This option allows you to exclude packages by keyword during installation/updates. Listing multiple packages for exclusion can be accomplished by quoting a space-delimited list of packages. Shell globs using wildcards (for example, * and ?) are allowed.
This sets the number of times yum should attempt to retrieve a file before returning an error. Setting this to 0 makes yum retry forever. The default value is 6.
groupremove_leaf_only=<1 or 0>
Setting this option to 1 causes yum to check the dependencies of each package when removing a package group, and to remove only those packages which are not not required by any other package or group. The default value for this directive is 0, which means that removing a package group will remove all packages in that group regardless of whether they are required by other packages or groups. For more information on removing packages, refer to Smart package group removal.