I think there used to be a way to put something like this in the
configuration file for yum, and I thought dnf as well. But I took a
quick look at the man page for dnf.conf and didn't see anything like
Indeed you could add, for example, exclude=kernel in yum.conf.
According to the manpage of dnf.conf, using exclude is also valid in
dnf.conf; see, for example,
http://www.dsm.fordham.edu/cgi-bin/man-cgi.pl?topic=dnf.conf&sect=5
I need to say that I did not try it with dnf, only with yum.
Regards,
Rami Rosen