YUM Remove Repo

Howto remove and disable YUM repo (repository). Yum command ifself does not contain any way to remove repository. Yum repo files is located in /etc/yum.repos.d/ directory.

I use zabbix.repo file with following content as example on this guid:

1
2
3
4
5
6
7
8
9
10
11
12
13
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/3.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1

Remove YUM Repo (Repository) Permanently

Before moving repository permanently is a good idea to check that is the repository installed using rpm package. As many repos usually are, like RPM-Fusion, Livna, etc.

Search Repository RPM-package with following command:

1
rpm -qa | grep -i repo-name

Example:

1
2
[root@localhost ~]# rpm -qa | grep zabbix
zabbix-release-3.0-1.el7.noarch

If RPM-package found then simply remove whols RPM-package with following command:

1
rpm -e some-repository-rpm-package-package

Example:

1
rpm -e zabbix-release-3.0-1.el7.noarch

If RPM-package not found then simply remove repo file with following command:

1
2
3
rm /etc/yum.repos.d/repo-file.repo
## OR
mv /etc/yum.repos.d/repo-file.repo /etc/yum.repos.d/repo-file.repo.bak

Disable YUM Repo (Repository)

Disable YUM Repo

Edit repo file on /etc/yum.repos.d/ as root and change enabled to 0

1
2
3
4
5
## Change
enabled=1

## To
enabled=0

Disable YUM Repo using YUM

1
yum --enablerepo=some-disabled-repository install some-package