Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
We recently needed to exclude the kernel from being updated on a VPS server. While this may not sound or seem ideal but there are certain scenarios where you don’t want to update the kernel every time you update packages on your server.
You’re standard yum update return something like this before the exclusion:
================================================================================ Package Arch Version Repository Size ================================================================================ Installing: kernel x86_64 3.10.0-1160.24.1.el7 updates 50 M Updating: bpftool x86_64 3.10.0-1160.24.1.el7 updates 8.5 M kernel-tools x86_64 3.10.0-1160.24.1.el7 updates 8.1 M kernel-tools-libs x86_64 3.10.0-1160.24.1.el7 updates 8.0 M libldb x86_64 1.5.4-2.el7 updates 149 k python-perf x86_64 3.10.0-1160.24.1.el7 updates 8.1 M screen x86_64 4.1.0-0.27.20120314git3c2946.el7_9 updates 553 k
Keep in mind, this is just an example case, the results would vary for you.
To exclude the kernel from yum update, you have to edit the file at /etc/yum.conf and add an exclude line at the end. Should look something like the following:
[main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=5 bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release exclude=kernel*
Save the file and issue yum update again at the terminal again. This is things look like now:
================================================================================ Package Arch Version Repository Size ================================================================================ Updating: bpftool x86_64 3.10.0-1160.24.1.el7 updates 8.5 M epel-release noarch 7-13 epel 15 k libldb x86_64 1.5.4-2.el7 updates 149 k python-perf x86_64 3.10.0-1160.24.1.el7 updates 8.1 M screen x86_64 4.1.0-0.27.20120314git3c2946.el7_9 updates 553 k
That’s it, you’re done!