2.2 Yum Configuration

2.2.1 Configuring Use of a Proxy Server
2.2.2 Yum Repository Configuration

The main configuration file for yum is /etc/yum.conf. The global definitions for yum are located under the [main] section heading of the yum configuration file. The following table lists the important directives.

Directive

Description

cachedir

Directory used to store downloaded packages.

debuglevel

Logging level, from 0 (none) to 10 (all).

exactarch

If set to 1, only update packages for the correct architecture.

exclude

A space separated list of packages to exclude from installs or updates, for example: exclude=VirtualBox-4.? kernel*.

gpgcheck

If set to 1, verify the authenticity of the packages by checking the GPG signatures. You might need to set gpgcheck to 0 if a package is unsigned, but you should be wary that the package could have been maliciously altered.

gpgkey

Pathname of the GPG public key file.

installonly_limit

Maximum number of versions that can be installed of any one package.

keepcache

If set to 0, remove packages after installation.

logfile

Pathname of the yum log file.

obsoletes

If set to 1, replace obsolete packages during upgrades.

plugins

If set to 1, enable plugins that extend the functionality of yum.

proxy

URL of a proxy server including the port number. See Section 2.2.1, “Configuring Use of a Proxy Server”.

proxy_password

Password for authentication with a proxy server.

proxy_username

User name for authentication with a proxy server.

reposdir

Directories where yum should look for repository files with a .repo extension. The default directory is /etc/yum.repos.d.

See the yum.conf(5) manual page for more information.

The following listing shows an example [main] section from the yum configuration file.

[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgkey=file://media/RPM-GPG-KEY
gpgcheck=1
pligins=1
installonly_limit=3

It is possible to define repositories below the [main] section in /etc/yum.conf or in separate repository configuration files. By default, yum expects any repository configuration files to be located in the /etc/yum.repos.d directory unless you use the reposdir directive to define alternate directories.

2.2.1 Configuring Use of a Proxy Server

If your organization uses a proxy server as an intermediary for Internet access, specify the proxy setting in /etc/yum.conf as shown in the following example.

proxy=http://proxysvr.yourdom.com:3128

If the proxy server requires authentication, additionally specify the proxy_username, and proxy_password settings.

proxy=http://proxysvr.yourdom.com:3128
proxy_username=yumacc
proxy_password=clydenw 

If you use the yum plugin (yum-rhn-plugin) to access the ULN, specify the enableProxy and httpProxy settings in /etc/sysconfig/rhn/up2date as shown in this example.

enableProxy=1
httpProxy=http://proxysvr.yourdom.com:3128

If the proxy server requires authentication, additionally specify the enableProxyAuth, proxyUser, and proxyPassword settings.

enableProxy=1
httpProxy=http://proxysvr.yourdom.com:3128
enableProxyAuth=1
proxyUser=yumacc
proxyPassword=clydenw
Caution

All yum users require read access to /etc/yum.conf or /etc/sysconfig/rhn/up2date. If these files must be world-readable, do not use a proxy password that is the same as any user's login password, and especially not root's password.

2.2.2 Yum Repository Configuration

The yum configuration file or yum repository configuration files can contain one or more sections that define repositories.

The following table lists the basic directives for a repository.

Directive

Description

baseurl

Location of the repository channel (expressed as a file://, ftp://, http://, or https:// address). This directive must be specified.

enabled

If set to 1, permit yum to use the channel.

name

Descriptive name for the repository channel. This directive must be specified.

Any other directive that appears in this section overrides the corresponding global definition in [main] section of the yum configuration file. See the yum.conf(5) manual page for more information.

The following listing shows an example repository section from a configuration file.

[ol6_u2_base]
name=Oracle Linux 6 U2 - $basearch - base 
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/2/base/$basearch 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY 
gpgcheck=1 
enabled=1

In this example, the values of gpgkey and gpgcheck override any global setting. yum substitutes the name of the current system's architecture for the variable $basearch.