How To Clean Yum Cache In CentOS/RHEL?

Yum is a tool used to manage packages in CentOS, RHEL, Fedora, etc. Yum simply downloads and installs packages or removes them. The downloaded packages are cached in the local system for future use. But this requires some disk space. The yum cache can be cleaned in different ways which are related to the cached file type.

yum clean packages

The “yum clean packages” is used to clear package data from the yum cache. The unused packages are stored in the cache and there is no problem with removing them. This command does not require root privileges.

yum clean packages

yum clean headers

The yum packages are provided with header information. Header information can be cleared by using the “yum clean headers” command.

yum clean headers

yum clean metadata

Yum package manager use metadata in order to to store meta information about the packages. These metadata also cached. The metadata of the yum can be cleared with the following command.

yum clean metadata

yum clean all

Upto now we have cleared header, metadate, packages cache. But there is “yum clean all” command which cleans all of these cache types.

yum clean all

Disable Caching For yum

By default yum is configured to cache downloaded packages, headers, metadata etc. This caching configuration is set in the file “/etc/yum.conf”. The configuration name is “keepcache”. Please change this configuration value to 0.

keepcache=0

Leave a Comment