If you’re a Linux system administrator or even a “mere” user, you’ve probably noticed that, when using a Red Hat-like system, if you do “yum update” it may well raise the minor version level (e.g. 6.7 to 6.9). In fact, it should move your system to the latest minor version (the number after the dot) of your current major version (the number before it).
You may, then, have wondered if it is possible to update your system and yet remain on your current version. You may even have been asked to do so by a very, very timid boss, or some development/application team (“this is supported only on Red Hat 7.1, we can’t move to 7.2!”).
Before I go on, I have to say that there is absolutely no technical reason to do this (EDIT: not necessarily true any longer, at least for 7.x, see CertDepot’s comment and link. Still true in most cases; the reason for this demand is almost always ignorance, fear, and laziness, not knowledge of any actual change causing incompatibilities). I really hope you’ve arrived here just because a boss, project manager or developer is demanding it (and, sadly, you don’t work at a place where you can say “no, that’s stupid, I won’t do it”… yet 😉 ), or simply because of scientific curiosity, not because you actually think that doing this is a good idea.
Red Hat (or CentOS) minor versions aren’t really” versions” in the usual sense, where new versions of software packages, libraries, etc. are included. Instead, (with a few desktop-related exceptions, such as web browsers) they take pains to only fix security problems and other bugs. If you look at a particular package’s versions, whether you’re on Red Hat Enterprise Linux 7.0 or 7.3, those always stay the same, only the “Red Hat” number (e.g. file-5.11-21.el7) increases. Therefore, there is never (EDIT: see above edit) any question of “compatibility”; it may, however, be a question of “officially supported”, which is code for “we tested our product with this version, and can’t be bothered to test it with any others.”
Sorry about the rant. 🙂 So, since you’re obviously a competent sysadmin, I’ll assume you’re being forced to do it. Here’s how:
To see which releases you have available:
subscription-manager release --list
# subscription-manager release --list
To lock on a release (e.g. 7.1):
subscription-manager release --set=7.1
And to unlock it:
subscription-manager release --unset
For a single update, add –releasever=x.y to your yum command; for instance:
yum --releasever=7.1 update
To set it permanently, add:
to the [main] section in your /etc/yum.conf file.
Notes: at least on CentOS, since CentOS 7.x, versions aren’t just “x.y”, they also include a third number, apparently the year and date of release. Browsing on http://vault.centos.org/centos/ , for instance, you see you have these versions available:
[DIR] 6.7/ 21-Jan-2016 13:22 -
[DIR] 6.8/ 24-May-2016 17:36 -
[DIR] 6.9/ 10-Apr-2017 12:48 -
[DIR] 6/ 10-Apr-2017 12:48 -
[DIR] 7.0.1406/ 07-Apr-2015 14:36 -
[DIR] 7.1.1503/ 13-Nov-2015 13:01 -
[DIR] 7.2.1511/ 18-May-2016 16:48 -
[DIR] 7.3.1611/ 20-Feb-2017 22:23 -
[DIR] 7/ 20-Feb-2017 22:23 -
and, yes, you have to specify the third number in your command/config file.
You may also have to enable the several entries in your /etc/yum.repos.d/CentOS-Vault.repo file (change enabled=0 to 1).