yum, Yellowdog Updater Modified, is an interactive, rpm based, package manager. It can automatically perform system updates, including dependency analysis and obsolete processing based on "repository" metadata.
In this post I'll go over 3 methods that can be used to permanently disable repositories in CentOS.
Method 1: yum-config-manager
yum-config-manager command can be used to disable repositories. To disable a YUM repository, log in as root, identify the repository ID and use yum-config-manager to disable it:
For example, assuming you'd want to disable ELRepo repository:
$ su
# yum repolist all
# yum-config-manager --disable elrepo
Method 2: edit repository file
Login as root and edit the repository file under /etc/yum.repos.d/ and change the enable flag enable=1 to enable=0.
For example, assuming you'd want to disable ELRepo repository:
$ su
# vim /etc/yum.repos.d/elrepo.repo
# Enabled repository
[elrepo]
name=ELRepo.org Community Enterprise Linux Repository - el6
baseurl=http://elrepo.org/linux/elrepo/el6/$basearch/
mirrorlist=http://elrepo.org/mirrors-elrepo.el6
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0
# Disabled repository
[elrepo]
name=ELRepo.org Community Enterprise Linux Repository - el6
baseurl=http://elrepo.org/linux/elrepo/el6/$basearch/
mirrorlist=http://elrepo.org/mirrors-elrepo.el6
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
protect=0
Upon running yum repolist you'll notice that the disabled repository no longer shows.
# yum repolist all
Method 3: remove repository file
Of course you can always use blunt force and simply remove the repo file from /et/yum.repos.d/.
For example, assuming you'd want to disable (in this case remove is a better word) the ELRepo repository:
$ su
# rm /etc/yum.repos.d/elrepo.repo
Run yum and check if the repository has been removed:
# yum repolist all
For further information on yum and its immense uses :
$ man yum
4 comments:
If you had installed packages from the repository you are going to disable / remove, then make sure you are not missing any security updates available for those packages.
Also, if the repository was installed through yum, the easiest (cleanest) way to remove it will be to use yum. In the case of ELRepo, it would be:
yum remove elrepo-release
[ I don't know why ELRepo was used as an example in this blog. It is a great repo. :-) ]
ELRepo provide additional hardware support, does not replace any distribution packages and works with most of the high-profile repositories, so indeed not the best example :-)
If it was installed/enabled it is likely that some packages from ELRepo were needed for hardware support, and disabling ELRepo will deprive you from future (security or bugfix) updates that may cause that hardware no longer to work in the future. Reader beware !
Indeed. ELRepo is the only external repository I have no qualms about enabling by default and setting to priority=1 (not that I would advocate that as universal advice, and it does not apply to elrepo-testing, elrepo-kernel, or elrepo-extras), and that was true even before I started helping out by building packages there. :-)
You would do well to use one of the repositories that does not play well with others as an example.
Thanks for taking the time to provide input.
You own your machine and as such if you want, for whatever reason, disable a repository you should be able to so if you wish.
ELRepo was merely used as an example. The post doesn't recommend adding or removing repositories. It lists methods to permanently disable repositories.
ELREPO was used as an example the same way that RPMforge, Adobe, ATrpms, etc could have been used.
In no way does the post imply that ELRepo is a lesser or better repository than any other. It was, once again, use as **an example**.
So if there any methods that you'd like to share on how to permanently disable repositories you're welcome to share them and I'll update the post.
Post a Comment