Remove or Disable YUM Repo (Repository)

Sometimes some Repo (Repository) defective, unusable. How to remove or disable this repo go?

You can not use the yum to delete repository which must use rpm . Yum repo files stored in the folder /etc/yum.repos.d/

Example Varnish repo file contents:

 [varnish-4.0]
name = Varnish 4.0 for Enterprise Linux
baseurl = https: //repo.varnish-cache.org/redhat/varnish-4.0/el6/$basearch
enabled = 1
gpgcheck = 0
gpgkey = file: /// etc / PKI / rpm-gpg / RPM-GPG-KEY-varnish

Guidelines delete YUM Repo (Repository)

Search the exact name of the repo

 rpm -qa | grep -i repo-name

For example:

 [[email protected] yum.repos.d] # rpm -qa | grep -i varnish
varnish-release-4.0-3.el6.noarch
varnish-libs-4.0.3-1.el6.x86_64
varnish-4.0.3-1.el6.x86_64
varnish-agent-4.0.1-1.el6.x86_64

If found repo, use the following command to delete

 -e repo-name

For example:

 -e varnish-release-4.0-3.el6.noarch

If you do not find the repo, direct delete files or change the file name .repo

 rm /etc/yum.repos.d/repo-file.repo
 
## OR just rename it (without repo file extension) ##
mv /etc/yum.repos.d/repo-file.repo /etc/yum.repos.d/repo-file.repo.bak

Disable YUM Repo (Repository)

In .repo file contents will be configured enabled . Go to enabled = 0 if you want to disable, and vice versa. This will have the effect of fixed, applicable to the whole of the statement yum later.

For example:

 [varnish-4.0]
name = Varnish 4.0 for Enterprise Linux
baseurl = https: //repo.varnish-cache.org/redhat/varnish-4.0/el6/$basearch
 enabled = 0 
gpgcheck = 0
gpgkey = file: /// etc / PKI / rpm-gpg / RPM-GPG-KEY-varnish

Alternatively, you can temporarily disable when using the command yum parameter - disablerepo

For example:

 yum install --disablerepo = some-some-package repository
Remove or Disable YUM Repo (Repository)
5 (100%) 10 vote