Howto remove/enable/disable/use a yum or RPM repo

The yum repos are described in files which are stored in /etc/yum.repos.d/ . So if you want to remove a yum repo you just gotta go to that dir and remove the file in question.

It’s more or less obvious why one would want to add a new repo (to get stuff from it!) but why would you want to remove a yum repo?

Well.. from time to time some of these repos go “stale” and when yum or RPM tries to connect to a dead repo it results in errors and sometimes even breaks the entire yum/rpm command (such that it is unable to complete).

REMOVING A REPO

Example:

$ yum grouplist
Loaded plugins: auto-update-debuginfo, langpacks, presto, refresh-packagekit
Setting up Group Process
http://repos.fedorapeople.org/repos/spot/chromium/fedora-15/i386/repodata/repomd.xml: [Errno 14] problem making ssl connection
Trying other mirror.
...
http://repos.fedorapeople.org/repos/spot/chromium/fedora-15/i386/repodata/repomd.xml: [Errno 14] problem making ssl connection
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: chromium. Please verify its path and try again

So as you can see yum complains that the chromium repo is not responding. Which one is it? Well.. lets see what we got in that directory I mentioned above…

$ ls -l /etc/yum.repos.d/
total 56
-rw-r--r-- 1 root root 179 Jul 25 2007 adobe-linux-i386.repo
-rw-r--r-- 1 root root 1144 Jun 24 2011 fedora.repo
-rw-r--r-- 1 root root 1105 Jun 24 2011 fedora-updates.repo
-rw-r--r-- 1 root root 1163 Jun 24 2011 fedora-updates-testing.repo
-rw-r--r-- 1 root root 377 Mar 28 2012 google-chrome.repo
-rw-r--r-- 1 root root 136 Mar 28 2012 google-chromium.repo
-rw-r--r-- 1 root root 1325 Feb 27 2012 rpmfusion-free-rawhide.repo
-rw-r--r-- 1 root root 1202 Oct 29 2011 rpmfusion-free.repo
-rw-r--r-- 1 root root 1200 Oct 29 2011 rpmfusion-free-updates.repo
-rw-r--r-- 1 root root 1260 May 17 2009 rpmfusion-free-updates-testing.repo
-rw-r--r-- 1 root root 1393 Feb 28 2012 rpmfusion-nonfree-rawhide.repo
-rw-r--r-- 1 root root 1247 Oct 29 2011 rpmfusion-nonfree.repo
-rw-r--r-- 1 root root 1245 Oct 29 2011 rpmfusion-nonfree-updates.repo
-rw-r--r-- 1 root root 1305 May 17 2009 rpmfusion-nonfree-updates-testing.repo

So it is probably the google-chromium.repo that’s giving us grief but just to be on the safe side let’s check the URL inside it:

$ cat /etc/yum.repos.d/google-chromium.repo
[chromium]
name=google-chromium - 32-bit
baseurl=http://repos.fedorapeople.org/repos/spot/chromium/fedora-15/i386/
enabled=1
gpgcheck=1

So you can see that the URL in this repo file is the one that yum complained about. Lets remove this file! 🙂

$ sudo rm /etc/yum.repos.d/google-chromium.repo

After we remove the faulty .repo files we can see that the yum grouplist command now completes properly:

$ yum grouplist
Loaded plugins: auto-update-debuginfo, langpacks, presto, refresh-packagekit
Setting up Group Process
rpmfusion-free/group_gz | 1.5 kB 00:00
rpmfusion-free-updates/group_gz | 1.5 kB 00:00
rpmfusion-nonfree/group_gz | 1.0 kB 00:00
rpmfusion-nonfree-updates/group_gz | 1.0 kB 00:00
Installed Groups:
Hardware Support
KDE (K Desktop Environment)
Sound and Video
System Tools
Available Groups:
Fonts
GNOME Desktop Environment
Games and Entertainment
Graphical Internet
Done

ENABLE/DISABLE RPM/YUM REPO

Another way of dealing with this problem would be disabling a repository. Here’s how you can enable/disable a repo:
– edit the .repo file and change the enabled=1 line to enabled=0
– use the yum-config-manager command, e.g.:

$ sudo yum-config-manager --disable google-chromium
$ sudo yum-config-manager --enable google-chromium

USING A RPM/YUM REPO

Here’s a complete example showing how to add and enable a repo and how to get updates from it.

1. First you need to add the repo to your list of repos. Usually this is done via a RPM meta package which installs the repo files in etc. For example, to get the remi repo you download the remi-release-22-4.fc22.remi.noarch.rpm file from https://rpms.remirepo.net/fedora/22/remi/x86_64/repoview/remi-release.html and install it like a norma RPM package. This adds the .repo files to /etc/yum.repos.d/

2. Enable the repo. Chances are it is enabled by default but doesn’t hurt to do it:

$ sudo yum-config-manager --enable remi

3. Update phpMyAdmin using the remi repo:

$ sudo yum --enablerepo=remi update phpMyAdmin

Or if you want also the release candidates (RC) versions of the packages, which is the latest code (good for you) but may no be as stable, beta-versions, nightly builds, etc (not so good)… so you decide if you want this. To do this add also the dev repo, which in the case of the remi repo could be done with this command

$ sudo yum --enablerepo=remi,remi-test update phpMyAdmin

Leave a Reply

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