centos7 升级最新版内核
升级系统
[[email protected] ~]# yum update -y
安装 ELRepo
-
[[email protected] ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
-
[[email protected] ~]# rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
安装新内核
-
[[email protected] ~]# yum remove -y kernel-headers kernel-tools kernel-tools-libs
-
[[email protected] ~]# yum --enablerepo="elrepo-kernel" install -y kernel-ml kernel-ml-devel kernel-ml-headers kernel-ml-tools kernel-ml-tools-libs kernel-ml-tools-libs-devel
更新 Grub 后重启
-
[[email protected] ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
-
Generating grub configuration file ...
-
Found linux image: /boot/vmlinuz-5.2.8-1.el7.elrepo.x86_64
-
Found initrd image: /boot/initramfs-5.2.8-1.el7.elrepo.x86_64.img
-
Found linux image: /boot/vmlinuz-3.10.0-862.14.4.el7.x86_64
-
Found initrd image: /boot/initramfs-3.10.0-862.14.4.el7.x86_64.img
-
done
-
[[email protected] ~]# awk -F\‘ ‘$1=="menuentry " {print i++ " : " $2}‘ /etc/grub2.cfg
-
0 : CentOS Linux (5.2.8-1.el7.elrepo.x86_64) 7 (Core)
-
1 : CentOS Linux (3.10.0-862.14.4.el7.x86_64) 7 (Core)
-
[[email protected] ~]# grub2-set-default 0
-
[[email protected] ~]# reboot
查看当前设置
-
[[email protected] ~]# grub2-editenv list
-
saved_entry=0
重启后确认内核版本已升级为最新版
-
[[email protected] ~]# uname -r
-
5.2.8-1.el7.elrepo.x86_64
安装 bcc-tools
项目地址:https://github.com/iovisor/bcc
注意:5.0 以上内核安装 bcc-tools 工具会有 bug. 参见: memleak error on 5.0.10-1.el7.elrepo.x86_64
建议升级成 4.1~4.20.13 之间的内核,参见: 历史内核版本列表
内核安装。参见:centos7 内核升级
[[email protected] ~]# yum install -y bcc-tools
配置 PATH 路径
[[email protected] ~]# export PATH=$PATH:/usr/share/bcc/tools
验证安装成功
[[email protected] ~]# cachestat
原文地址:https://www.cnblogs.com/zafu/p/12264485.html