Using Yum Commands to Disable and Remove Package Repositories on CentOS

YUM also called as Yellowdog Updater, Modified is a default package management system which is mostly used in all versions of CentOS to install and update packages and repositories. With the help of “yum” a user can maintain their OS and applications updates very easily. In this tutorial, we are going to see how to disable and remove package repositories on CentOS using yum.

Disabling a Package Repository #

Usually, the package repositories are located in the definition files, which can be found in the directory named /etc/yum.repos.d . In order to disable the file, you need to modify the proper file and set the below given parameter.

enable = 0

The above parameter will keep the repository, however it will disable it until you decide to use it in future.

Removing the Repository Completely #

If you wish to remove the repository completely, simply delete the aforesaid file.

How to Clear the YUM Cache? #

Generally, when a package is downloaded, installed and then it is removed there is a possibility that the package may still be memorized in the yum’s cache. In order to clean all the cached packages from the enabled repository cache directory, enter as root:

yum clean packages

In addition to that, to purge the old package information completely, simply run the following command.

yum clean headers

To clean any cached xml metadata from any enabled repository, enter:

yum clean metadata

If you wish to clean all the cached files from any enabled repository at once, enter:

yum clean all

To make sure that YUM has fresh data and functions perfectly all the time, you should “clean” it on a regular basis.

Powered by BetterDocs