By default the current versions of yum erase the data and packages that they have downloaded immediately after they have been successfully used in an operation by yum. This minimizes the storage space required to operate. However, you can enable a cache system to cause yum to retain the files it has downloaded. The advantages are the following:
Improve on the performance.
You can operate yum without an internet connection.
You can copy packages from the cache and reuse them at will.
By default, yum stores its temporary files in /var/cache/yum/
with a subdirectory for the configured repository. The directory packages/
inside of each subdirectory maintains the packages in the cache. For example, /var/cache/yum/x86_64/13/fedora/packages
maintains the downloaded packages of the fedora repository.
To enable the use of the cache, use the directive keepcache
in /etc/yum.conf
.
/etc/yum.conf
[main]
cachedir=/var/cache/yum
keepcache=1
gpgcheck=1
plugins=1
...
To clear the cache you must use the yum clean
command with some of its options:
yum clean expire-cache
Removes the local data if necessary for each repository. This means that yum will revalidate the cache for each repo, if the cache is invalid nothing will be removed.
yum clean packages
Delete the packages from the cache.
yum clean headers
Delete the package headers from the cache.
yum clean metadata
Removes all files that yum uses to determine the package availability. This command will force yum to download all the necessary metadata the next time you use it.
yum clean dbcache
Removes the sqlite cache used for faster access to metadata. This command will force the download of yum metadata the next time it runs.
yum clean rpmdb
Removes the data from local rpmdb cache.
yum clean plugins
Causes the enabled plugins to delete their cached data.
yum clean all
Execute all of the previous commands.