Purging the yum header and package cache

Most of the Linux distributions that utilize the yum package manager cache headers and packages by default. These files are cached in the directory identified by the cachedir option, which defaults to /var/cache/yum on all of the hosts I checked. On my Fedora 16 desktop this directory has grown to 167MB in size:

$ du -sh /var/cache/yum
167M /var/cache/yum

You can clean out the cached directory with the yum “clean” option:

$ yum clean all

If disk space is an issue on your systems, you can also set the “keepcache” option to 0. This will remove cached files after they are installed, as noted in yum.conf(8)the manual page:

keepcache Either `1' or `0'. Determines whether or not yum keeps
          the cache of headers and packages after successful installation.
          Default is '1' (keep files)

This is a useful option for hosts that have limited disk space. Nice!

Leave a Comment