From Fedora Project Wiki
m (Fixed template and links)
m (Docs/Drafts/AdministrationGuide/ManagingSoftware/CustomizingYum moved to Archive:Docs/Drafts/AdministrationGuide/ManagingSoftware/CustomizingYum: This page references a newer draft version. Archiving old page tree then I'll go back and redirect to)
(No difference)

Revision as of 17:48, 4 March 2009

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

Author: RahulSundaram

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.

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

Downloadonly Plugin

FIXME: Figure out how plugin works and document that.

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

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://wiki.linux.duke.edu/WritingYumPlugins. Join the yum development list at https://lists.dulug.duke.edu/mailman/listinfo/yum-devel to collaborate with Yum developers.

Installing Software from an Isolated Package Software Management Table of Contents Next Page - Working with yum Caching