Yum Update: How to temporarily or permanently exclude certain packages

This tutorial is useful if you’ve found yourself in a scenario where you want to run yum update, but you want to hold back certain packages.

Temporarily Excluding Certain Packages:

To temporarily hold back a package when running yum update via the command line:

Run yum update with the exclude option. For example, to prevent Yum from updating the kernel, use the command like this:

yum –exclude=kernel* update

To prevent Yum from updating PHP, you would use this command:

yum --exclude=php* update

To exclude multiple packages, run the command like this:

yum --exclude=php* –-exclude=kernel* update

Permanently Excluding Certain Packages:

Edit /etc/yum.conf

Append the following line containing your packages under [main] section:

exclude=php* kernel*

This entry was posted in Centos and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *