centos7 升级最新版内核 并安装 bcc-tools

centos7 升级最新版内核

升级系统

[root@jikeshijian ~]# yum update -y

安装 ELRepo

[root@jikeshijian ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[root@jikeshijian ~]# rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

安装新内核

[root@jikeshijian ~]# yum remove -y kernel-headers kernel-tools kernel-tools-libs
[root@jikeshijian ~]# 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 后重启

[root@jikeshijian ~]# 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

[root@jikeshijian ~]# 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)

[root@jikeshijian ~]# grub2-set-default 0
[root@jikeshijian ~]# reboot

查看当前设置

[root@jikeshijian ~]# grub2-editenv list
saved_entry=0

重启后确认内核版本已升级为最新版

[root@jikeshijian ~]# 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 内核升级

[root@jikeshijian ~]# yum install -y bcc-tools

配置 PATH 路径

[root@jikeshijian ~]# export PATH=$PATH:/usr/share/bcc/tools

验证安装成功

[root@jikeshijian ~]# cachestat 

猜你喜欢

转载自www.cnblogs.com/liyongjian5179/p/11344492.html