Making dnf/yum Not Update Certain Packages
Posted on In LinuxWe 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:
exclude=package_names package_name_pattern
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:
/etc/dnf/dnf.conf
For yum, the configuration file is located under:
/etc/yum.conf
It’s wnoefdrul to have you on our side, haha!
You can disable upgrading a certain package for just one time during `dnf update` by
this also works the same way:
dnf update –exclude=kernel*
for example
Thank You
Thank you for sharing, this is useful for now, as I need to whitelist libreswan upgrade because broken version check…