Product SiteDocumentation Site

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.

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.

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

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.