It is recommended to regularly clean the cache of YUM to ensure that the working cache remains current.
Yum will create a cache that consists of metadata and packages. These files are very useful, but over time they will accumulate in size to such an extent that you will probably find that Yum is acting erratically.
The frequency of this happening can vary from system to system but it generally implies that the Yum cache system requires your immediate attention.
We look at a quick solution that will serve to assist you in cleaning the cache and restoring Yum to its original working state.
First, clean any cached package information, log in as root
# yum clean packages
Now remove any cached XML-based metadata
# yum clean metadata
Remove any cached database files
# yum clean dbcache
Following this you will want to clean all the files to confirm the preceding instructions and to ensure that unnecessary disk space is not used
# yum clean all
Rebuild the Yum cache by typing
# yum makecache
Yum is a very powerful tool that is known for its ability to resolve package dependencies and automate the process of package management, but as with all things, there are times when even the best utilities can get confused and may report errors or behave erratically.
Fixing this issue is relatively simple and the approach outlined will help keep your package manager in a healthy running state for the life time of your operating system.
During its typical operation Yum will create a cache of metadata and packages found in /var/cache/yum. These files are essential, but as they grow in size this cache will slow down the overall use of this utility and may even cause some issues.
To address this situation we started by using the following command to clean the current package-based cache.
We then followed this by cleaning the metadata cache, which would remove any excess XML-based files.
Yum uses SQLite as a part of its normal operation, so the next step was to remove any remaining database files.
The penultimate step was to clean all files associated with enabled repositories in order to reclaim any unused disk space.
Finally, we restored Yum to its normal working state by rebuilding the cache.
So you run through the steps above in order to keep Yum in an optimal working state.
Labels: Centos 6, RHEL cleaning Yum cache