升级CentOS内核
最近忙着wireguard的配置。
如果使用VPS,那么先决条件是:内核版本>3.10的KVM虚拟机。
首先,OpenVZ的虚拟机是不行的。因为共享内核不能改变。所以至少需要KVM的虚拟机。
其次,内核版本小于等于3.10不行,因为无法装载wireguard模块。
不幸的是,CentOS就使用的古老的3.10内核,哪怕CentOS 7也一样。于是,安装时系统会报告:
RTNETLINK answers: Operation not supported
所以,不得不进行内核升级。
从elrepo升级的命令如下:
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
sudo yum --enablerepo=elrepo-kernel install kernel-lt
VPS虚拟机的问题是,你只能远程登录上去,一旦重启系统,立刻丢会掉线。
所以,要选定升级的内核,需要自己修改grub配置。
简单地说,先重构grub配置:
grub2-mkconfig
然后,看看/etc/grub2.cfg里面,哪一个内核是4.0以上的。
用
grub2-editenv - set saved_entry='CentOS Linux (4.4.150-1.el7.elrepo.x86_64) 7 (Core)'
指定缺省内核。
重启系统,用 uname -r检查,应该已经升级成功了。
Leave 升级CentOS内核 to:
Read more #cn posts
Best Posts From causenet
We have not curated any of causenet's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.