Presentation of yum plugins
The yum package manager can see its features enhanced through plugins.
To allow these plugins to work, the plugins variable needs to be set to 1 in the /etc/yum.conf file but it is the default value. Plugin configurations are stored in the /etc/yum/pluginconf.d directory. In this directory, any plugin can be enabled/disabled by assigning 1/0 to the enabled variable located in its configuration file.
Adding a new yum plugin is like installing any package.
Unfortunately, all the yum plugin packages don’t follow the same convention: most are called yum-plugin-name but some are named yum-name.
The yum-utils package is not really a plugin but it brings many useful tools to the yum package manager: package-cleanup, repoquery, reposync, yum-complete-transaction, yum-config-manager, yum-groups-manager, yumdb, yumdownloader, etc.
By default, yum comes with two already enabled plugins: fastestmirror and langpacks.
# yum update Loaded plugins: fastestmirror, langpacks ...
As there are more than 20 existing yum plugins, only some of them will be presented below.
Package name: yum-plugin-changelog
Function: add the –changelog option or the changelog subcommand displaying information about changelog.
- when String: set to ‘pre‘ or ‘post‘ to see changes before or after transaction (‘pre‘ by default)
- always Boolean: set to true, to always get the output (removes the cmd line arg) (false by default).
- yum changelog httpd displays the changelog of the httpd package.
- yum changelog 5 httpd displays the last 5 changes of the httpd package.
- yum update –changelog shows all the changes coming with the update.
Package name: yum-plugin-fastestmirror
Function: sorts each repository’s mirrorlist according to connection speed before starting any download. Mirror sites and their associated connection speeds are stored in a cache.
- verbose Boolean: 0/false means minimal display, 1/true produces additional messages (0/false by default).
- always_print_best_host Boolean: this defines whether the best mirror is shown or not (true by default).
- socket_timeout Integer: it is the default timeout for a socket connection (3 seconds by default).
- hostfilepath String: this is the path to the plugin’s cache file (‘timedhosts‘ by default), you need to add /var/cache/yum/x86_64/7 to get the complete path.
- maxhostfileage Integer: this represents the maximum age of the plugin’s cache file (10 days by default).
- loadcache Boolean: this defines whether fastest mirrors are loaded from plugin’s cache or not (false by default).
- maxthreads Integer: this is the biggest number of threads used in parallel (15 by default).
- exclude String: this defines a comma separated list of mirror sites to exclude (none by default).
- include_only String: this defines a comma separated list of mirror to include (none by default).
- prefer Boolean: this specifies whether a preferred mirror exists or not (‘no.prefer.mirror‘ by default).
- downgrade_ftp Boolean: this defines whether ftp sites come first or not (true by default).
Package name: yum-langpacks
Function: add support for automatic and manual installation of langpacks. Read yum group metadata, install/remove language packs according to the languages set.
- langpack_locales String: this defines the locale used.
- yum langavailable lists the available language packs.
- yum langinfo lists information about particular language packs.
- yum langinstall installs language packs.
- yum langlist prints the installed language packs.
- yum langremove removes language packs.
Package name: yum-plugin-priorities
Function: allows repositories to have different priorities. Packages in a repository with a lower priority can’t be overridden by packages from a repository with a higher priority even if the repository has a later version. Priority are assigned to each repository in its associated repository file through the priority variable (99 by default, 0 being the highest priority).
An example of priorities assigned in the various repository files could be:
[base] -> priority=1 [updates] -> priority=1 [centosplus] -> priority=2 [extras] -> priority=3 [epel] -> priority=11
- check_obsoletes Boolean: if set to 1, protect high-priority repositories against obsolete packages in low-priority repositories (0 by default).
- only_samearch Boolean: if set to 1, excludes packages from lower priority repositories based on the package name and architecture; if set to 0, excludes based on the package name (0 by default).
Note: The yum –showduplicates list myrpm command can help you find the duplicated packages (here for myrpm).
Package name: yum-versionlock
Function: takes a set of name/versions for packages and excludes all other versions of those packages. This allows you to protect packages from being updated by newer versions.
- follow_obsoletes Boolean: if set to 1, look at all the obsoletes and see if any of the packages specified have an obsoleter (0 by default).
- locklist String: this defines the file where all the version lock information is stored (/etc/yum/pluginconf.d/versionlock.list by default).
- yum versionlock add httpd forbids an upgrade of the httpd package.
- yum versionlock list displays the list of all the packages that can’t be upgraded.
- yum versionlock delete httpd allows an upgrade of the httpd package again.
- yum versionlock clear allows an upgrade of all the packages again.