Tuesday, 10 May 2011

Use of yum priorities

Some time ago I faced a need to have some useful tools installed with the stable core packages on my CentOS servers. How I did it? I've added an rpmforge repository to the yum configuration and disabled it with enabled=0 in the repository configuration, because if you leave it enabled, some packages that you need to be more stable could be upgraded with the newest versions from rpmforge. Then, when I need to install something out of the main, I did it like that:

# yum --enablerepo=rpmforge install some-tool

Of course it was inconvenient, I had problems with updates and so on.

Then, a single look on the yum documentation showed me the yum-priorities package.
Now I have all the repositories enabled and prioritized. For example, the [base] repository has priority=1 and [rpmforge] has priority=20.
This way, yum update will not replace httpd with the latest version from rpmforge, and  yum install htop  will succeed. Of course, you can make it in another way. For example, you can add a PostgreSQL repository and make it higher priority than base/updates - this way you'll always keep your postgresql packages up-to-date using just  yum update  without a need to upgrade it manually.

No comments:

Post a Comment