Product SiteDocumentation Site

10. Working with yum Caching

By default, current versions of yum delete the data files and packages that they download, after these have been successfully used for an operation. This minimizes the amount of storage space that yum uses. You may enable caching, so that yum retains the files that it downloads in cache directories.
Caches provide three advantages:
  • The performance of yum increases
  • You may carry out yum operations without a network connection, by using only the caches
  • You may copy packages from the caches and reuse them elsewhere
By default, yum stores temporary files under the directory /var/cache/yum/, with one subdirectory for each configured repository. The packages/ directory within each repository directory holds the cached packages. For example, the directory /var/cache/yum/development/packages/ holds packages downloaded from the development repository.

Clearing the yum Caches

Cached files use disk space until removed. You may wish to periodically clear the yum caches to recover capacity. Refer to Section 10.3, “Clearing the yum Caches” for information on clearing the caches.
If you remove a package from the cache, you do not affect the copy of the software installed on your system.

10.1. Enabling the Caches

To configure yum to retain downloaded files rather than discarding them, set the keepcache option in /etc/yum.conf to 1:
Refer to Section 9.1, “Editing the yum Configuration” for more information on editing the yum configuration file.
Once you enable caching, every yum operation may download package data from the configured repositories. To ensure that the caches have a set of package data, carry out an operation after you enable caching. Use a list or search query to download package data without modifying your system.