Remove yum repo using yum

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).

Asked By: Malabarba

||

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)

Answered By: h3rrmiller

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

Answered By: Mark Cohen

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:

epel-release-5-4
yum remove epel-release-5-4
yum clean all
Answered By: Vadim Sluzky

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

Answered By: Dovev Hefetz

Feel free to correct me if i am wrong. If you do sudo you are basically doing it as root or administrator basically equivalent as a run as admin level command for the windows only types.

The temporary way to do it, but do i trust whole heartedly there will never ever run into an issue with something weird caching bugging out not at all. something like yum –disablerepo=some-repository install some-package could work but see below.

I would suggest rm or copy the actual file corresponding to the repo to another dummy directory or even temporarily creating a new directory just for this ocasion with a mkdir command. directory where it is useless. Potentially could be a safe enough thing to try to use to avert any type of caching issue that may be cause by temporarily disabling that directory.

Then again this is based on preference i guess. I just prefer the safe route and keeping file integrity over ima just run this command and hope it works.

Answered By: Benjamin Limback

On RedHat if you are (well you must be) using YUM then, look under:

/etc/yum.repos.d/

Whatever repos you have are there, I would move the one you don’t need into another directory (I don’t usually like to delete incase).

Cheers

H

Answered By: Heider Sati
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.