initCommon(); $template->displayHeader(); ?>

9. Customizing yum

To change the behavior of yum, you may either edit the configuration files, or install plugins. Plugins enable developers to add new features to yum.

9.1. Editing the yum Configuration

The file /etc/yum.conf provides the main configuration for yum. Settings in a repository definition file override the main configuration for those operations that use the defined repository.

To edit /etc/yum.conf, run a text editor with root privileges. This command opens /etc/yum.conf with gedit, the default text editor for Fedora desktop systems:

su -c 'gedit /etc/yum.conf'

Enter the password for the root account when prompted.

The main configuration file provides the settings that apply to all yum operations. These include caching options, and proxy server settings. The directory /etc/yum.repos.d/ holds definition files for each repository that yum uses. Plugins use the configuration files in the directory /etc/yum/pluginconf.d/.

The following sections in this document provide further information on configuring yum:

[Tip]Further Documentation

Refer to the man page for yum.conf for a complete list of the configuration options supported by yum.

9.2. Working with yum Plugins

Each yum plugin is a single file, written in the Python programming language. You may download plugins from the yum project Web site, or from third-party providers. The yum project maintains a list of plugins on the page http://wiki.linux.duke.edu/YumPlugins.

[Tip]Plugin File Extension

The names of yum plugin files end with .py, the standard extension for Python scripts.

To install a plugin, copy it to the directory /usr/lib/yum-plugins/. Create a configuration file for the plugin in the directory /etc/yum/pluginconf.d/. Save the configuration file with the same name as the plugin, but with the extension .conf.

[Note]root Privileges Required

You must have root access to add files to the directories /usr/lib/yum-plugins/ and /etc/yum/pluginconf.d/.

For example, to copy the plugin exampleplugin.py, enter the command:

su -c 'cp exampleplugin.py /usr/lib/yum-plugins/'

Enter the password for the root account when prompted.

You may then create a configuration file for the plugin with a text editor. This example uses gedit, the default text editor for Fedora desktop systems:

su -c 'gedit /etc/yum/pluginconf.d/exampleplugin.conf'

Enter the password for the root account when prompted.

Each plugin configuration file includes the enabled setting. Some plugins also require additional settings. To determine the correct settings, either refer to the documentation supplied with the plugin, or read the plugin file itself with any text editor.

[main]
enabled=1
anotheroption=0

Example 3. Example Plugin Configuration File

[Note]Plugin Installed by Default

Fedora Core includes the installonlyn plugin. This plugin modifies yum to remove excess kernel packages, so that no more than a set number of kernels exist on the system. By default, installonlyn retains the two most current kernels, and automatically removes older kernel packages.

To remove a plugin, delete both the original file and the automatically generated bytecode file from /usr/lib/yum-plugins/. The bytecode file uses the same name as the plugin, but has the extension .pyc. Remove the relevant configuration file in /etc/yum/pluginconf.d/.

This command removes the plugin exampleplugin:

su -c 'rm -f /etc/yum/pluginconf.d/exampleplugin.conf; rm -f /usr/lib/yum-plugins/exampleplugin.py*'

Enter the password for the root account when prompted.

displayFooter('$Date: 2006/05/25 02:44:31 $'); ?>