Home / Software / How to force YUM to exclude certain packages

How to force YUM to exclude certain packages

YUM logoQuestion: Is there a way to tell YUM to ignore certain packages when performing updates on a CentOS Linux server?

Answer: There certainly is, and in some cases it can save your server from an unfortunate mishap. When running a dedicated server, particularly one with multiple websites, you run the risk of alienating a particular site or site application by updating key services without first testing them.

For example, the Linux kernel, PHP, and even Apache release new versions on a regular basis, but sometimes a new version might break currently installed scripts or applications. By excluding those or other packages from updates, you can ensure that you have time to notify users and clients and prepare updates of any scripts.

To use the exclude function, edit your yum.conf file:

Under the [main] section, add the following line:

exclude=php* kernel*

This would exclude any package with the words “php” or “kernel”. You can list any packages there. If you only want to exclude a package from a specific update instance, you can exclude it directly from the command line:

# yum --exclude=packagename* update

Check Also


Importance of web hosting to business

The world of business is very ruthless and unfair in some cases. It is a …