Managing Yum Plugins
Yum is one of the most widely used package management tools, but many users don't know that Yum has a plugin system to extend its capabilities. Let's take a look at how to extend Yum to add some very useful features.Yum is one of the most widely used package management tools, but many users don't know that Yum has a plugin system to extend its capabilities. Learn how to add some very useful features by extending this open source tool.
If you're using Fedora, Red Hat Enterprise Linux (RHEL), CentOS, or a number of other RPM-based systems, you are probably very familiar with using Yum to install packages and update your system. It's very useful out of the box, so to speak, but it can be extended to add even more functionality.
Plugins are Python scripts/programs that extend Yum's feature set. They're located under /usr/lib/yum-plugins, and the configuration files live under /etc/yum/pluginconf.d/. Plugins must be enabled in the Yum configuration file (/etc/yum.conf), so make sure the plugins directive is set to "1" rather than "0."
For the purposes of this tip, I'm using Fedora 14. This is important to bear in mind because the plugins available on Fedora 14 are likely to be different from the ones available on earlier Fedora releases or RHEL and CentOS. Since Fedora tends to be more leading edge, you may find plugins for Fedora that aren't yet available on CentOS and RHEL. But the basic concept of plugins is the same.
To search for the available plugins, run yum search yum-plugin. You should see several plugin packages available. Some are also shipped by default as part of the main Yum package, and if you look under /etc/yum/pluginconf.d/ you should see several configuration files for plugins already available on your system. For example, the Presto plugin. This plugin enables support for delta RPMs. In F14 this is enabled by default.
Let's say you want to be able to use yum to download files -- but not install them. There are two ways to do this. First, you can use the yumdownloader utility that comes with the yum-util package. (Installed by default.) The other way, which is handy if you want to download updates before installing, is to use yum update package--downloadonly. But to do that, you need the yum-plugin-downloadonly package installed.
Run yum install yum-plugin-downloadonly. This will add the file /etc/yum/pluginconf.d/downloadonly.conf and enable the plugin. Now run yum install package--downloadonly or yum update package--downloadonly and Yum will just grab the files needed for the install or update.
Yum has many plugins that can help boost its functionality. Next week we'll look at working with the Security plugin, how to set priorities and more.
Joe 'Zonker' Brockmeier is a freelance writer and editor with more than 10 years covering IT. Formerly the openSUSE Community Manager for Novell, Brockmeier has written for Linux Magazine, Sys Admin, Linux Pro Magazine, IBM developerWorks, Linux.com, CIO.com, Linux Weekly News, ZDNet, and many other publications. You can reach Zonker at email@example.com and follow him on Twitter.