Knowledgebase Home / How to Clean the YUM Cache in CentOS
// View Comments //

How to Clean the YUM Cache in CentOS

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.

  1. Clean all the cached packages from the enabled repository cache directory.
    yum clean packages
  2. Delete package headers.
    yum clean headers
  3. Delete metadata for each enabled repository.
    yum clean metadata
  4. 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.
Shared Hosting | Reseller Hosting | Managed WordPress Hosting | Fully Managed VPS Hosting

Our Guiding Principles

  • Provide consistent, stable, and reliable web hosting services.
  • Ensure rapid ticket response and quick resolutions to issues.
  • Never saturate or over-provision servers to ensure stability and speed for our customers.
  • Use only high-quality enterprise-class hardware to ensure minimal downtime from hardware failures.
  • Provide clear pricing with no hidden fees or gotchas.
Subscribe to comment notifications
Notify of
Inline Feedbacks
View all comments