36

I'm a *.deb guy and I feel quite uncomfortable while managing rpms.

I'm used to run apt-get upgrade in my debian based servers for "normal" upgrades and apt-get dist-upgrade for allowing kernel upgrades or allowing new major package versions upgrades.

In the CentOS servers I admin, I would like to have a similar feature, however man yum doesn't seem to offer such behaviour. And the differences between yum update and yum upgrade seems to be not what I'm looking for.

So far my best approach is to add and remove the following setting in /etc/yum.conf:

exclude=kernel*

There must be a better approach. Every suggestion will be welcome.

EDITED:

The yum's man page description of them and the --obsoletes flag is a bit cryptic for me. So let me reword what I understand from it: Do I have to understand that yum update won't install a new kernel because it would mean marking as obsolete the current one? Can I assume that yum upgrade does the same or almost the same than apt-get dist-upgrade?

EDITED 2

What I like best from apt-get upgrade is that it tells me which packages remain retained so I can act accordingly; either with apt-get dist-upgrade or with explicit apt-get install package.

So after thinking a bit my best approach at this moment will be: disable the obsoletes setting in yum.conf (as described by Steven Pritchard in his answer) and run at first yum update. Once all the updates are installed, run a second yum update --obsoletes to check which packages have been retained and act in function of its results.

Will that work?

hmontoliu
  • 3,693
  • 3
  • 22
  • 24

2 Answers2

63

yum update originally just did upgrades of packages to new versions. If, for example, foo-awesome obsoleted foo, yum update wouldn't offer to upgrade from foo to foo-awesome. Adding the --obsoletes flag to yum update made it do the extra checks to also offer that upgrade path. yum upgrade was added as (essentially) an alias for yum --obsoletes update. Since this is the behavior that almost everyone wants all of the time, the configuration option obsoletes=1 was added to the default /etc/yum.conf, making yum update and yum upgrade equivalent on any recent, stock, Fedora/RHEL/CentOS/etc.

If you want to avoid kernel updates when you're running yum update, you can just do yum --exclude=kernel* update. If you want automatic updates on, but you want to avoid automatic kernel upgrades, then adding the exclude to yum.conf is probably the right answer.

There probably isn't a Right Answer for your question. RHEL and RHEL-based distributions don't have the same philosophy as the Debian developers when it comes to updates, so the tools don't encourage the same sorts of behavior.

  • +1 Steven; I guess that there won't be a *right answer*, that's why I want as much feedback as possible. Your answer is excellent. Let me wait for other people approaches :-) – hmontoliu Aug 05 '11 at 17:35
  • See my **EDITED 2**, so far I believe that is a good approach to mimic apt-get behavior. – hmontoliu Aug 05 '11 at 17:50
  • You can also add excludes to the yum.conf file. – Not Now Aug 05 '11 at 19:06
5

Try

# yum upgrade yum kernel
# yum -y upgrade
Sven
  • 97,248
  • 13
  • 177
  • 225
af-at-work
  • 670
  • 1
  • 6
  • 12