centos 升级内核以及安装bcc工具

centos7 升级最新版内核

升级系统

[root@jikeshijian ~]# yum update -y

安装 ELRepo

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

安装新内核

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

  1.  
    [root@jikeshijian ~] # grub2-mkconfig -o /boot/grub2/grub.cfg
  2.  
    Generating grub configuration file ...
  3.  
    Found linux image: /boot/vmlinuz-5.2.8-1.el7.elrepo.x86_64
  4.  
    Found initrd image: /boot/initramfs-5.2.8-1.el7.elrepo.x86_64.img
  5.  
    Found linux image: /boot/vmlinuz-3.10.0-862.14.4.el7.x86_64
  6.  
    Found initrd image: /boot/initramfs-3.10.0-862.14.4.el7.x86_64.img
  7.  
    done
  8.  
     
  9.  
    [root@jikeshijian ~] # awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
  10.  
    0 : CentOS Linux (5.2.8-1.el7.elrepo.x86_64) 7 (Core)
  11.  
    1 : CentOS Linux (3.10.0-862.14.4.el7.x86_64) 7 (Core)
  12.  
     
  13.  
    [root@jikeshijian ~] # grub2-set-default 0
  14.  
    [root@jikeshijian ~] # reboot

查看当前设置

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

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

  1.  
    [root@jikeshijian ~] # uname -r
  2.  
    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/zafu/p/12264485.html