How To Exclude Packages from Apt-Get Upgrade
1. Exclude Packages with Command
You can simply use –exclude command line parameter with yum to exclude specific packages from getting update. You can specify multiple packages as per your requirement. For example, below command will update all packages except kernel and php.
2. Exclude Packages from Auto Update
In addition, You can also add entries in /etc/yum.conf to disable packages updates permanently. Using this option, you don’t need to specify each time you run yum update command from prompt. This will also prevent packages from any accidental update. Edit /etc/yum.conf in editor and add exclude line as showing in below example configuration file. The below will prevent updating packages name begin with the kernel, redhat-release, php, mysql, and httpd.
3. Exclude 32-bit or 64-bit Packages
Also, you can ignore the specific package architecture. Like you need to exclude 32-bit or 64-bit packages from auto update. Specify them in /etc/yum.conf as below.
Conclusion
This tutorial helps you to exclude specific packages from the yum update. You can easily exclude any packages or group of packages from yum update and prevents accidental rpm updates.