From Fedora Project Wiki

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:

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.

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

9.3 Useful Plugins for Fedora Users

Yum is easily extensible through plugins and a number of plugins have been written by many developers. These plugins advance the core capabilities of Yum and add more features. This section covers the plugins that are useful to Fedora users.

Downloadonly Plugin

This plugin tells yum to download the package(s) from a mirror server but stop after downloading. Yum will not install the package. Usage of this plugin is:

su -c 'yum install <package> --downloadonly'

Installonlyn Plugin

Usually software package updates work by removing the older package, retaining the configuration and installing the newer version of a package. Kernel packages are more unique since newer versions can be installed in parallel. Every release of Fedora usually receives a number of kernel updates during its lifecycle due to the general policy of staying close to upstream projects. Each of these kernel updates then occupy space and over time will clutter the initial boot loader options. To prevent this, the installonlyn plugin leaves "n" number of kernel packages by default removing the oldest ones first sequentially on updates. Fedora Core 5 onwards installs this plugin by default. In Fedora, this plugin retains the current kernel and two latest updates. You can disable this plugin or configure it to retain a different number of kernels by setting the value in the file /etc/yum/pluginconf.d/installonlyn.conf

Fastest Mirror Plugin

Yum in Fedora uses a dynamic server side mirror management infrastructure that distributes the bandwidth consumptions on each of these mirrors by automatically directing the update to one of the geographically closest mirrors. This mirror is automatically checked against the master server for consistency.

The fastest mirror plugin enhances the speed of updates by maintaining a local offline hostfile cache of the speed of the mirrors. It sorts the mirror list by speed and prioritizes the faster ones for package downloads. This plugin is not installed by default. For installing it, use the following command or from the Applications menu use Add/Remove Software".

su -c 'yum install yum-fastestmirror'

You can configure various settings of this plugin in the file /etc/yum/pluginconf.d/fastestmirror.conf

Security Plugin

This plugin extends yum to allow lists and updates to be limited using security relevant criteria. This may be important to you if you are using Fedora in a production mode and you don't want to break your software with an untested upgrade.

For installing it, use the following command or from the Applications menu use Add/Remove Software".

su -c 'yum install yum-security'

There are two yum commands that are used with this plugin:

  • info-sec
  • list-sec

Both of these commands take these sub-commands:

  • <advisory> [advisory...]
  • bugzillas
  • cves
  • security

Examples

To list all updates that are security relevant, and get a return code on whether there are security updates use:

su -c 'yum --security check-update'

To apply updates that are security relevant use:

su -c 'yum --security update'

To get a list of all BZs that are fixed for packages you have installed use:

su -c 'yum list-sec bugzillas'

To get the information on advisory FEDORA-2707-4567 use:

su -c 'yum info-sec FEDORA-2707-4567'

For additional information, view the man page:

man yum-security

YumUtils

Yum-Utils is a collection of tools written using the Yum API. The individual tools are explained below. For additional information on these tools you can consult the manual man <package> or visit the YUM website .

Package Cleanup

Package-Cleanup is a program used for cleaning up RPMs that you have installed on your computer. By using one of the many options available you can easily find problems in your current installed packages. Package-Cleanup will list dependency problems, find RPMs that aren't being relied upon by any other RPM, locate installed packages which are not available from currently configured repositories, and remove old kernel and kernel-devel packages.

Repo-RSS

Repo-RSS is a program for generating RSS feeds for Yum repositories. You can specify the name, URL, title, description of the feed, and the number of days to consider recent.


Repoquery

Repoquery is a program for querying information from YUM repositories in much the same was as RPM queries.


Reposync

Reposync is used to synchronize a remote yum repository to a local directory. Reposync uses yum to retrieve these packages and can even create custom requests for the newest packages, only updates, or a combination of these and more.

Yum-Builddep

Yum-Builddep is a program which installs the RPMs needed to build a package. The source RPM for the package can be from the Yum repository or from a local source.

Yum-Complete-Transaction

Yum-Complete-Transaction is a program that attempts to complete aborted or incomplete transactions on a system and attempts to complete them. By using the transaction logs in /var/lib/yum this program will attempt to complete the most recent unfinished transaction first. You can run it more than once to clean up all unfinished transactions.

YumDownloader

Yum-Downloader is a utility that downloads RPMs from Yum repositories. You can have the utility show you the URL from where the RPM would be downloaded from, have it automatically resolve dependencies, and allow you to also download the source for the RPMs.

Changelog Plugin

When Fedora developers provide a update to a existing package, they describe the changes in the new update in the software package change log. This plugin helps you see the package changelog before doing a update. This plugin is not installed by default. For installing it, use the following command or from the Applications menu use Add/Remove Software".

su -c 'yum install yum-changelog'

Sample output:

su -c 'yum update frysk --changelog'
Loading "changelog" plugin
Setting up Update Process
Setting up repositories
Reading repository metadata in from local files
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package frysk.i686 0:0.0.1.2006.12.01.rh1-1.fc6 set to be updated
--> Running transaction check

Changes in packages about to be updated:

frysk - 0.0.1.2006.12.01.rh1-1.fc6.i686
* Sat Dec  2 03:30:00 2006 Stepan Kasal <skasal@redhat.com> - 0.0.1.2006.12.01.rh1-1
- New upstream version.
- Resolves: #211288.


* Fri Dec  1 03:30:00 2006 Stepan Kasal <skasal@redhat.com> - 0.0.1.2006.11.30.rh1-1
- New upstream version.
- The stamp file for glade files has been renamed.



Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Updating:
frysk                   i686       0.0.1.2006.12.01.rh1-1.fc6  updates           7.5 M

Transaction Summary
=============================================================================
Install      0 Package(s)
Update       1 Package(s)
Remove       0 Package(s)

Total download size: 7.5 M
Is this ok [y/N] :

By default, the package changelog is showed before doing an update. If you prefer to see the changelog after doing an update instead, you can change the setting from when=pre to when=post in the file /etc/yum/pluginconf.d/changelog.conf. A sample output after the configuration has been changed from 'pre' to 'post'

su -c 'yum update frysk --changelog'
Loading "changelog" plugin
Setting up Update Process
Setting up repositories
Reading repository metadata in from local files
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package frysk.i686 0:0.0.1.2006.12.01.rh1-1.fc6 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Updating:
frysk                   i686       0.0.1.2006.12.01.rh1-1.fc6  updates           7.5 M

Transaction Summary
=============================================================================
Install      0 Package(s)
Update       1 Package(s)
Remove       0 Package(s)

Total download size: 7.5 M
Is this ok [y/N] : y
Downloading Packages:
(1/1): frysk-0.0.1.2006.1 100% |=========================| 7.5 MB    04:24
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating  : frysk                        ######################### [1/2] 
Cleanup   : frysk                        ######################### [2/2] 

Changes in updated packages:

frysk - 0.0.1.2006.12.01.rh1-1.fc6.i686
* Sat Dec  2 03:30:00 2006 Stepan Kasal <skasal@redhat.com> - 0.0.1.2006.12.01.rh1-1
- New upstream version.
- Resolves: #211288.


* Fri Dec  1 03:30:00 2006 Stepan Kasal <skasal@redhat.com> - 0.0.1.2006.11.30.rh1-1
- New upstream version.
- The stamp file for glade files has been renamed.



Updated: frysk.i686 0:0.0.1.2006.12.01.rh1-1.fc6
Complete!

Skip-broken Plugin

Yum by default checks to make all dependencies are resolved before doing a update, however on occasions like when testing the Fedora development tree or when there is a known dependency issue in the software repository it is useful to skip the broken dependencies automatically instead of having to manually specify the exact packages to ignore in the command line or yum configuration file. The skip-broken plugin helps do that. This plugin is not installed by default. For installing it, use the following command or from the Applications menu use Add/Remove Software".

su -c 'yum install yum-skip-broken'

You can use this plugin doing a update by specifying the following command line argument.

su -c 'yum update --skip-broken'

You can disable this plugin by changing the option in the file /etc/yum/pluginconf.d/skip-broken.conf

Allowdowngrade Plugin

The core Yum package manager does not have the functionality to let users downgrade a package. This is a design choice to favor robustness over the additional functionality. Unlike package updates, downgrades are not tested usually and hence may not have the desired effect. However advanced users would still find this feature useful to recover out of a broken update. This plugin adds the ability to perform downgrades of packages in Fedora. This plugin is not installed by default. For installing it, use the following command or from the Applications menu use Add/Remove Software".

su -c 'yum install yum-allowdowngrade'

You can use this plugin doing a update by specifying the following command line argument.

su -c 'yum update -allow-downgrade'

You can disable this plugin by changing the option in the file /etc/yum/pluginconf.d/allowdowngrade.conf

Notification and Auto Downloading, Installing of Updates

An interesting service is that of yum-updatesd. Yum-Updatesd will notify you of pending updates and can even be setup to automatically download and install the updates for you.

All settings are stored in /etc/yum/yum-updatesd.conf and the file should look like this:

[main] 
run_interval = 3600
updaterefresh = 600

emit_via = dbus
dbus_listener = yes

do_update = no
do_download = no
do_download_deps = no

Because yum-updatesd runs as a service, you must restart the service after editing /etc/yum/yum-updatesd.conf.

su -c '/sbin/service yum-updatesd restart'

Disabling All Plugins

If you would like to disable all the plugins while running Yum, you can use the following command line argument

su -c 'yum update --noplugins'

Developing New Plugins

If you are interested in developing your own plugins to add new features or change the behavior of Yum, refer to the guidelines at http://yum.baseurl.org/wiki/WritingYumPlugins. Join the yum development list at http://lists.baseurl.org/mailman/listinfo/yum-devel to collaborate with Yum developers.

Previous Page - 8. Installing Software from an Isolated Package Table of Contents Next Page - 10. Working with yum Caching