21

I have set up a local yum repository which I use to install test builds. For the testing purposes, my packages are versioned by <svn version number>.<date>.<time> (e.g. 12345.20110908.150404

The trouble is, once I make a new RPM, copy it to the repository directory and run createrepo $REPO_DIR, yum does not see the new RPM as being available.

$ cd $REPO_DIR
$ ls -1
repodata
package-12345.20110908.150404-1.x86_64.rpm
package-12345.20110908.174329-1.x86_64.rpm

$ createrepo .
# ...snip...

$ rpm -q package
package-12345.20110908.150404-1.x86_64

$ yum list --showduplicates package
Installed Packages
package.x86_64    12345.20110908.150404-1    @repo
Available Packages
package.x86_64    12345.20110908.150404-1    repo

I can see the updates and grab them if I run yum clean all and then re-fetch the metadata, but I think this just means I need to be doing something else from the repo, as I don't have to do that for other yum repos.

How do I need to set up my local repository so that I only need to run yum update from the client without having to clean my yum cache?

5 Answers 5

26

You can run "yum clean expire-cache" which is much more efficient way to tell yum to check the repos. ... the other thing to do would be to change the metadata_expire value for the local repo. (see man yum.conf).

2
  • Is there a way to expire-cache only specific repository?
    – myroslav
    Nov 17, 2014 at 12:52
  • 1
    The only easy way to do that is --disablerepo=* --enablerepo=myrepo,otherrepo ... although you can create an alias if it's something you'll do a lot. Nov 17, 2014 at 21:34
11

Try adding following line in /etc/yum.conf on Yum clients:

metadata_expire=1m

Following command shows you more info:

man yum.conf

FYI. CentOS 5 has the parameter commented out. CentOS 6.2 has 90m for the value.

1
  • This is somewhat old, but I just ran into this. You can set this value for a single repository by editing the /etc/yum.repos.d/my.repo file.
    – jwm
    Oct 8, 2019 at 1:06
3

yum clean metadata cleans up just the cached names and such, after which yum reloads its idea of what is available.

1

Just had the same issue, try:

yum clean all

2
  • 1
    Please read the question carefully. I believe he was looking for an alternative method where he didn't have to clear the cache.
    – slm
    Apr 3, 2013 at 1:41
  • god you're so right :|
    – jobwat
    May 6, 2013 at 6:44
0

yum's --enablerepo=localrpmrepo is the option you are after. so

yum --enablerepo=localrpmrepo clean metadata

replace localrpmrepo with your repos name

2
  • Nope, in this case, the problem is certainly that it thinks the cache is still valid and doesn't check for updates. May 30, 2014 at 21:04
  • I was able to update just one repository using this statement and another one: yum --disablerepo=* --enablerepo=epel clean metadata -q; yum check-update --disablrepo=* --enablerepo=epel -q. I'll just make a bash function and be done with it!
    – bgStack15
    Dec 9, 2016 at 12:52

You must log in to answer this question.

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