repos and latest version question

Issues related to applications and software problems
Post Reply
hokie1999
Posts: 39
Joined: 2011/08/10 15:03:16

repos and latest version question

Post by hokie1999 » 2020/03/23 13:46:50

Can someone verify this:

On CentOS 7, when installing a package via yum, if the version number is not specified, the latest/newest version of that package is selected from the repo and installed. This assumes the repo (when I say repo, I'm speaking of a corporate repo we manage) has been updated via createrepo -d .

For instance say a repo has these versions of httpd:

2.4.6
2.3.11
2.2.34

A yum install like so:

yum -y install httpd

ONLY installs 2.4.6

Could use confirmation on this.

Thanks! :D

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: repos and latest version question

Post by TrevorH » 2020/03/23 14:52:01

Yes, it will pick the highest version number available. That behaviour can be altered by use of things like yum-plugin-priorities (now built into yum itself) where you can assign different priorities to different repos with 1 being the most preferred and 99 being the least. If the same named package is found in two different repos with different priorities then it will pick the one from the repo with the highest priority and use that. You should ordinarily assign priority=1 to all CentOS supplied repos so that packages from base/updates are preferred over ones supplied from other repos but if you maintain your own repos and wish those to be picked first then you would need to adjust that.

You can also use includepkgs= in the individual repo files to restrict it to selecting only those named packages from that repo. Similarly you can use exclude= to remove packages from a particular repo.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

hokie1999
Posts: 39
Joined: 2011/08/10 15:03:16

Re: repos and latest version question

Post by hokie1999 » 2020/03/23 18:06:24

Thanks, again! :P

hokie1999
Posts: 39
Joined: 2011/08/10 15:03:16

Re: repos and latest version question -- follow-up question

Post by hokie1999 » 2020/04/27 13:26:53

Let's say i have packages in a repo directory /var/www/html/Packages. If I create a directory /var/www/html/Packages/xyz and in that I place an rpm xyz.rpm, I would run createrepo . d in that directory /var/www/html/Packages/xyx -- am I understanding that correctly?

Thanks! :D

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: repos and latest version question

Post by TrevorH » 2020/04/27 14:45:36

No, you run createrepo against the top level directory that you want to use as the repo. So if you have /var/www/html/Packages then you'd probablt be aiming to run createrepo /var/www/html/Packages unless your 'xyz' happens to be something else useful like say '6', '7' or '8' and you aim to have 3 repos there for the different versions of CentOS in which case you'd want to run createrepo 3 times against /var/www/html/Packages/8 etc.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

hokie1999
Posts: 39
Joined: 2011/08/10 15:03:16

Re: repos and latest version question

Post by hokie1999 » 2020/04/27 16:36:28

if I see this in my repo:

[cirtvm147 mirror]# pwd
/home/mirror


[cirtvm147 mirror]# ls
CentOS cirt deb esg7 hp-stuff images mongodb salt


[cirtvm147 mirror]# yum repolist all

repo id repo name status
base CentOS-7 - Base enabled: 10,092+5
.
.
.
salt Salt Packages enabled: 277


then do you think it is likely that for salt createrepo -d . was run from the salt directory or in other words, createrepo -d /home/mirror/salt ?

This involves production equipment, fyi.

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: repos and latest version question

Post by TrevorH » 2020/04/27 16:49:42

I can't tell you whether that's what it did or even whether it needs createrepo run at all. If you - for example - rsync a repo from a mirror then you don't need to run createrepo at all (and probably shouldn't) since rsync will copy the metadata direct from the mirror and the createrepo is just a waste of time and energy and might even be corrupting it.

And your CentOS repo, no idea from that what it contains as it might have no sub-dirs in it and you might not have 'updates' synced or even enabled and that's sort of important.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

hokie1999
Posts: 39
Joined: 2011/08/10 15:03:16

Re: repos and latest version question

Post by hokie1999 » 2020/04/27 16:56:28

Ok, thanks.

Post Reply