In this article, we will show you to clean the YUM cache in CentOS.
As we all know YUM is an open-source command-line package-management utility for Linux systems using the RPM Package Manager. As a Linux user, it is very useful for us. It manages packages, dependencies and updates on Linux systems. When a package is downloaded, installed and removed there are chances that the package may still be stored in YUM’s cache. The cached packages are usually located in /var/cache/yum.
There will be situations where we need to clean the YUM cache to reclaim the disk space used or to fix some errors due to corrupted metadata files.
To do this you must be logged in to the server as root user and execute the following commands.
- Clean all the cached packages from the enabled repository cache directory.
yum clean packages
- Delete package headers.
yum clean headers
- Delete metadata for each enabled repository.
yum clean metadata
- Clean all cached information.
yum clean all
Done! You have successfully learned how to clear the YUM cache on CentOS systems.

If you have any web hosting questions please feel free to reach out to us. We're happy to help.