Skip to content

Instantly share code, notes, and snippets.

@pgporada
Last active December 18, 2021 11:11
Show Gist options
  • Save pgporada/bee21b339b6ca750f1de to your computer and use it in GitHub Desktop.
Save pgporada/bee21b339b6ca750f1de to your computer and use it in GitHub Desktop.
Upgrade Kernel on Centos7 via ELRepo
Install the ELRepo and GPG key
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum install -y http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Enable kernel updates from elrepo
yum-config-manager --enable elrepo-kernel
Remove old kernel stuff
yum remove -y kernel-{devel,tools,tools-libs}
Install the ELRepo built kernel and grub2-tools
yum install -y kernel-ml kernel-ml-{devel,tools,tools-libs} grub2-tools
We ensure these exist on the off chance they were removed during the kernel stuff above
yum install -y dkms gcc redhat-lsb-languages
Build a new grub config with the ELRepo kernel entry
grub2-mkconfig -o /boot/grub2/grub.cfg
grep vmlinuz /boot/grub2/grub.cfg
Ensure we boot the latest kernel
grub2-set-default 0
@thpryrchn
Copy link

I think you should remove the -y from yum remove -y kernel-{devel,tools,tools-libs} so that the user can see what all will be removed before they commit to running it.

@pgporada
Copy link
Author

Hi @thpryrchn,

That's a good idea, but this was initially what I used on servers before I built ansible automation to do it for me. When starting up the server and having a script perform the task, you don't exactly need to worry what packages are removed as long as the server comes online post-reboot with the new el-repo kernel.

@thpryrchn
Copy link

thpryrchn commented Jul 25, 2019

Aww.. BTW, the repo install has changed... It is now yum -y install https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm

@pgporada
Copy link
Author

Thanks! I haven't used any of this particular code in years and it is woefully out of date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment