YUM is a package management system for Red Hat Enterprise Linux, Fedora, and Red Hat-based distributions such as CentOS and Scientific Linux. With yum you can keep your operating system and applications up to date without much hassle. The following tutorial will explain how to use yum to remove packages, purge old package headers, and disable package repositories.
1. Disable a package repository
Package repositories are typically specified in definition files that you can find in the /etc/yum.repos.d directory. To disable the file, edit the appropriate file and set the following parameter:
enable = 0
This will keep the repository but disable it until you decide to use it again.
2. Completely remove a repository
If you decide you do not want to use a repository at all, you can disable it by deleting the aforementioned file.
3. Clear the yum cache
If you have downloaded, installed, and then later removed packages, those packages may still be stored in yum’s cache. To remove all packages from the cache, type as root:
yum clean packages
Additionally, to fully purge old package information, you should run this command:
yum clean headers
and in CentOS, type:
yum clean metadata
To clean everything in one stroke, type:
yum clean all
YUM is a very powerful package management tool, and you should periodically “clean” it to make sure it has fresh data and always functions properly. Over time we will provide more tutorials for YUM and other Linux package managers.