YUM Remove Repo (Repository) – YUM Disable Repo (Repository)

Quick guide, howto remove and disable YUM repo (repository). Yum command itself does not contain any way to remove the repository. YUM repo files is located in /etc/yum.repos.d/ directory.

I use kde.repo file with following content as example on this guide:

[kde]
name=kde
mirrorlist=http://apt.kde-redhat.org/apt/kde-redhat/fedora/mirrors-stable
gpgkey=http://apt.kde-redhat.org/apt/kde-redhat/kde-redhat.RPM-GPG-KEY
enabled=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:

rpm -qa |grep -i repo-name

Example:

rpm -qa |grep -i rpmfusion
rpmfusion-nonfree-release-13-2.noarch
rpmfusion-free-release-13-2.noarch
 
## OR ##
 
rpm -qa |grep -i livna
livna-release-1-1.noarch

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

rpm -e some-repository-rpm-package

Example:

rpm -e livna-release-1-1.noarch

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

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

Example:

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

Disable YUM Repo (Repository)

Disable YUM Repo

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

## Change
enabled=1
 
## To
enabled=0

Example:

# Change
[kde]
name=kde
mirrorlist=http://apt.kde-redhat.org/apt/kde-redhat/fedora/mirrors-stable
gpgkey=http://apt.kde-redhat.org/apt/kde-redhat/kde-redhat.RPM-GPG-KEY
enabled=1
 
# To
[kde]
name=kde
mirrorlist=http://apt.kde-redhat.org/apt/kde-redhat/fedora/mirrors-stable
gpgkey=http://apt.kde-redhat.org/apt/kde-redhat/kde-redhat.RPM-GPG-KEY
enabled=0

Enable disabled repo quickly with YUM:

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

Disable YUM Repo (Repository) using YUM

yum --disablerepo=some-repository install some-package

Example:

yum --disablerepo=kde install some-package
Follow If Not True Then False Updates!

6 Comments

  1. How can I remove all installed packages from a repository without listing each package?

    • Hi Jonathon,

      This is quick trick to remove all packages from yum repository:

      yum --disablerepo="*" --enablerepo=google-chrome list available |grep "google-chrome" |awk -F ' ' '{print $1}' |xargs yum -y remove

      Run first without |xargs yum -y remove to see what is really happening…and be careful anyway, as always with delete/remove commands :)

  2. Thank you very much! Helped me a lot :)

  3. Thanks, very helpful.

  4. Thank you very much for your very clear illustrations and instructions. You certainly helped me to restore updates to Fedora20. On August 01st 2014, I had tried installing an image editor, but the installation failed and subsequently prevented Fedora20 from accessing updates. I searched the web for help but found nothing that worked until I found your excellent article today. Thanks very much again. “Much of the good things in life are indeed free”

Leave a Comment

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackbacks/Pingbacks

  1. yum install command point me to a local directory - […] t to 'target' local repo, then look in /etc/yum.repos.d/ You can either delete the .repo file for the …