We may not want to update some packages such the kernel on a stable server while updating the system. If we run “dnf update” or “yum update”, we may get suggested by dnf/yum to install all the packages with updates.
In this post, how to make
dnf/yum not update certain packages such the kernel when updating system will be introduced.
Method making dnf/yum not update certain packages ∞
The method is simple. Add this line to dnf or yum’s configuration file:
For example, to exclude package kernel*, nss and nss-* from being updated, the line will be:
exclude=kernel* nss nss-*
Package names are separated by a space. Shell globs using wildcards (eg. * and ?) are allowed.
The configuration file for dnf/yum ∞
The configuration file for dnf and yum are different. For newer systems like Fedora 22+, the dnf one will be used unless you install the yum-obsoleted package.
For dnf, the configuration file is located under:
For yum, the configuration file is located under: