How to Exclude Specific Packages from Yum Update
Hold or Exclude Packages from Upgrade
Use the following command to exclude or hold specific Debian package from an update. This will turn off the updates of specified packages from an automatic upgrade or manual upgrades.
Using aptsudo apt-mark hold package_name Using dpkgecho “package_name hold” | sudo dpkg –set-selections Using aptitude sudo aptitude hold package_name
Change the package_name with your actual package name to be set on hold.
List Packages on Hold
You can check the packages on hold anytime. Use the following command to view all packages already set to hold.
Unhold or Enable Package Upgrade
In future, If you need to upgrade any package set on hold. You need to unhold any package before an upgrade. Use one of the following commands to unhold any package.
Using aptsudo apt-mark unhold package_name Using dpkgecho “package_name install” | sudo dpkg –set-selections Using aptitude sudo aptitude unhold package_name
Now, the unhold packages will be upgraded with apt upgrade or unattended upgrades.
Conclusion
In this tutorial, you have learned to hold packages from unnecessary upgrades. You can remove hold any time from package to allow upgrade again.