I have no root access on my machine at work, but I have sudo permission to use sudo yum (and only yum).

Recently I accidentally installed a faulty repository (dropbox), and now I'd like to remove it. Since I have no write access to the yum.repos.d directory, manually editing or removing the repo file is out of the question.

I know you can install repos using yum (it's what I did), but can you remove a repo using yum?

Using Scientific Linux 6.

By the way, I know I can yum --disablerepo= to ignore the problematic repo. But I would like to remove it for good, because it's also causing problems with the graphical package manager (it keeps popping up notifications saying the updates couldn't be retrieved).

  • I also know how to fix the problematic repo. So a way of just overwriting it is also welcome. – Malabarba Nov 2 '12 at 11:54

you can remove the repo with yum-config-manager but not with yum:

yum-config-manager --disable repository
yum-config-manager --add-repo http://www.example.com/example.repo

EDIT: you need some way of running this as root (ie. sudo)

  • Ok, thanks. I'll wait around a bit more, but I might just boot up a live CD and remove the repo file. I didn't want to "hack" anything =P, but it's for a good reason. – Malabarba Nov 2 '12 at 12:44
  • if your sudoers line is just yum (and not the full path) you could copy /bin/bash to your working directory, prepend . to your PATH (export PATH=.:$PATH) and sudo yum that will fork a bash with root privs for you – h3rrmiller Nov 2 '12 at 14:09

In order to remove the actual yum repository rather than just to disable it, you have to find the package and remove it.

rpm -qa | grep epel

Sample outputs:

yum remove epel-release-5-4
yum clean all
  • Not all yum repositories are added via RPM packages. – cherdt Mar 1 '18 at 16:12

You can temporarily remove/disable a yum repo by adding the --disablerepo=(reponame) to your yum line.

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

Unfortunately, that's the only way to do it with yum/sudo

  • he already established that he knew how to do that (the italicized text at the bottom of his question) – h3rrmiller Nov 5 '12 at 21:13

You may be able to go into /etc/yum.repos.d/ and remove the file corresponding to the repository.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.