Yum cache refers to the local repository of metadata and packages that Yum maintains to speed up package management tasks. Cleaning the Yum cache removes all cached metadata and packages that are associated with them. It ensures that Yum only uses the cached data from the enabled and tracked repositories that are not expanded with unnecessary data.
This guide will explain the step-by-step guide to clean yum cache for untracked repositories on CentOS:
- How to Clean yum Cache for Untracked Repositories?
- List all Enabled Repositories
- Clean yum Cache
- Verify the List of Repositories
How to Clean yum Cache for Untracked Repositories?
It is a good practice to find out the untracked repository and then remove/clean the cache. The step-by-step instructions are as followed:
Step 1: List all Enabled Repositories
Before cleaning the yum cache, it’s important to know which repositories are enabled on the CentOS system. To list all the enabled repositories, run the “repolist” command with the “enabled” option:
# yum repolist enabled
It displays a list of all the enabled repositories on the system. Now, target one of them, which is the “epel” repository.
Step 2: Clean yum Cache
To clear the cache for all enabled repositories, including any untracked repositories, run the following command:
# yum clean all
It removes all cached data from the yum cache. It cleans the metadata and packages for all enabled repositories.
Note: To clean the cache for a specific repository, including an untracked repository, use the “yum –enablerepo=<reponame> clean all” command.
Step 3: Verify the List of Repositories
To view a list of repositories, run the “yum” command with the “repolist”:
# yum repolist
The output shows that untracked repositories have been removed from the system.
To clean the yum cache for untracked repositories, execute the “yum clean all” command. To verify the status of all the enabled repositories, use the “yum repolist enabled” command. It ensures that Yum only uses the cached data from the enabled and tracked repositories.
This guide has explained the step-by-step instructions to clean the yum cache for untracked repositories on CentOS.