2

I am working on Oracle Linux. I am trying to create a local repository and install RPM packages from there using yum install. I created a local repository and added a .repo file in the /etc/yum.repos.d/ directory. I run the following commands.

yum clean all
yum update
yum repolist

status = 0

Why isn't it detecting the RPM package in the directory?

5 Answers 5

3

I found a solution for the repolist showing the status zero. Apparently, it is because of the rest of the .repo files in the /etc/yum.repos.d/ directory. Just rename the files to an extension other than .repo or move them to another directory leaving on the one you need behind. After that, run the following:

yum clean all
yum update
yum repolist

The status should now be fixed.

fixed

Here is another description for the same solution.

However, please be aware that doing this will remove those other repositories from your list and you won't be able to download packages from them. To use them again, simply put them back with the proper extension and they'll work fine.

4
  • You shouldn't rename the other repos - you should just do the yum clean bit. Removing other repos will have undesirable side effects.
    – John
    Sep 1, 2016 at 12:21
  • @John It didn't work that way. I tried. You're welcome to try.
    – Alchemist
    Sep 1, 2016 at 12:21
  • in this folders /etc/yum/ when run : 'ls' command the results : protected.d repos.d vars version-groups.conf yum.conf yum-daily.yum yum-weekly.yum what about this? in debian Dec 12, 2017 at 15:49
  • 1
    @sabertabatabaeeyazdi It looks like its a different directory you mentioned. The one you should be looking for is /etc/yum.repos.d/
    – Alchemist
    Dec 13, 2017 at 8:56
1

I found a simpler solution to this. Just do

sudo touch /etc/yum.repos.d/<your_repo_file>
yum repolist

You should see your repo is refreshed. I don't know why it is like this, my assumption is that yum doesn't bother to refresh a repo that hasn't been updated.

1

The recommended solution here did not work for me. This does not work either.
After seeing this, the proposed solution here looks wrong, indeed.

The correct approach to adding repos to yum should be:

  1. sudo yum-config-manager --add-repo myrepo
  2. sudo nano myrepo.repo

Edit baseUrl parameter providing a valid repo url. A working repo sample looks like:

[myrepo]
name=repoDemo
baseurl=http://mirror.centos.org/centos/7/os/x86_64/
enabled=1
  1. sudo yum-config-manager --enable myrepo.repo

Running yum repolist will not show 0 repos anymore, rather your repoDemo instead.

0

It may happen if you are incorrectly adding spaces in the repo name:

[Base Old Repo] #<--- WRONG
Name=CentOS-$releasever - Base
baseurl=http://mirror.centos.org/centos/6/os/x86_64/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Instead:

[BaseOldRepo] #<--- CORRECT
Name=CentOS-$releasever - Base
baseurl=http://mirror.centos.org/centos/6/os/x86_64/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
-1

I have the same problem on Cento 7. When I try to add an new repo ... The command yum repolist show zero status for all the latest repo .. I don't know what, exactly, the problem is, but I think that the system needs specific time to check and update the repolist database

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .