因为一些调试及测试需要,我们的centos需要安装高版本内核以便进行BCC和BPF的实时调试功能。
下面是我的安装过程:
查看当前OS版本
cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
安装elrepo
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
列出elrepo-kernel相关的软件包
[root@localhost /root ] # yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* elrepo-kernel: mirrors.tuna.tsinghua.edu.cn
Available Packages
elrepo-release.noarch 7.0-4.el7.elrepo elrepo-kernel
kernel-lt.x86_64 4.4.212-1.el7.elrepo elrepo-kernel
kernel-lt-devel.x86_64 4.4.212-1.el7.elrepo elrepo-kernel
kernel-lt-doc.noarch 4.4.212-1.el7.elrepo elrepo-kernel
kernel-lt-headers.x86_64 4.4.212-1.el7.elrepo elrepo-kernel
kernel-lt-tools.x86_64 4.4.212-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs.x86_64 4.4.212-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs-devel.x86_64 4.4.212-1.el7.elrepo elrepo-kernel
kernel-ml-doc.noarch 5.5.0-1.el7.elrepo elrepo-kernel
kernel-ml-headers.x86_64 5.5.0-1.el7.elrepo elrepo-kernel
kernel-ml-tools.x86_64 5.5.0-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs.x86_64 5.5.0-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs-devel.x86_64 5.5.0-1.el7.elrepo elrepo-kernel
perf.x86_64 5.5.0-1.el7.elrepo elrepo-kernel
python-perf.x86_64 5.5.0-1.el7.elrepo elrepo-kernel
安装相关的内核包:
yum --enablerepo=elrepo-kernel install kernel-ml kernel-ml-devel.x86_64
查看当前存在的内核版本
[root@localhost /root ] # sudo awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (5.5.0-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-957.27.2.el7.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-862.11.6.el7.x86_64) 7 (Core)
3 : CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)
4 : CentOS Linux (0-rescue-81b73827307a43799b9968e81edddb2f) 7 (Core)
设置5.5.0的内核为默认启动项
grub2-set-default 0
grub2-mkconfig -o /boot/grub2/grub.cfg
重启系统
reboot
再次查看
[root@localhost /root ] # uname -r
5.5.0-1.el7.elrepo.x86_64
[root@localhost /root ] # uname -a
Linux localhost 5.5.0-1.el7.elrepo.x86_64 #1 SMP Sun Jan 26 20:12:30 EST 2020 x86_64 x86_64 x86_64 GNU/Linux
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。