CentOS / RHEL – Delete Old Yum Repositories and Configuration Files

Sometimes you may face the issue to install or update packages due to old repositories. So the question is, how can I delete old yum repositories and configuration files under CentOS and RHEL 5 Linux server?

WHMCS Complete Billing and Support

In this article, we will discuss how can we remove a repository. You can delete old yum repositories and their configuration files from /etc/yum.repos.d/ directory.


Option #1: Manual removal of Repo configuration files using rm command

First, you will have to login to your server via SSH. Make sure you have root proveleges. After login execute the following commands:

# cd /etc/yum.repos.d/
# ls -l

Output of the above command should like:

-rw-r–r– 1 root root  954 May 11  2011 epel.repo
-rw-r–r– 1 root root 1054 May 11  2011 epel-testing.repo
-rw-r–r– 1 root root  561 Dec 14  2011 rhel-debuginfo.repo
-rw-r–r– 1 root root  222 Dec 14  2011 rhel-source.repo
-rw-r–r– 1 root root  235 Jan 16 15:27 srpm.repo

To delete epel.repo, enter:

# rm epel.repo epel-testing.repo

Youwill also need to delete GPG keys. Execute the following commands:

# rm /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
# yum clean all

Option #2: Delete Repo .rpm Package

First you will need to find the repo package name. For example, if we need to remove epel repo, first search for rpm using the following command:

# rpm -qa | grep epel

It should show as follow:


Now, run the following commands to remove it:

# yum remove epel-release-5-4
# yum clean all

Posted in Linux.

Leave a Reply

Your email address will not be published. Required fields are marked *