Knowledgebase Home / How to Clean the YUM Cache in CentOS

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.

How useful was this post?

Click on a star to rate it!

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!


If the steps above listed in this article do not resolve your issue, please feel free to open a support ticket and we’d be happy to take a look. Looking for better web hosting? Sign up today and take 50% off your first month with promo code: 1stmonth50

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.