运维开发网

centos7安装bcc-tools

运维开发网 https://www.qedev.com 2020-08-31 12:55 出处:51CTO 作者:草根追逐
bcc-tools需要内核版本为4.1或者更新的版本,我们首先需要升级内核yumupdate-ycat/etc/redhat-releaseCentOSLinuxrelease7.5.1804(Core)centos版本在7.3以上就不需要update更新了安装elrepo内核rpm--importhttps://www.elrepo.org/RPM-GPG-KEY-elrepo.orgrpm-U

bcc-tools 需要内核版本为 4.1 或者更新的版本,我们首先需要升级内核

yum update -y
cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)

centos版本在7.3以上就不需要update更新了

安装elrepo内核

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

然后先 rpm -qa |grep kernel查看内核包

先卸载旧的 kernel-headers,kernel-tools, kernel-tools-libs,kernel-devel只保留内核,然后

yum --enablerepo=elrepo-kernel install  kernet-lt kernel-lt-headers kernel-lt-tools kernel-lt-tools-libs kernel-lt-devel.x86_64

然后设置:grub2-mkconfig -o /boot/grub2/grub.cfg

生成启动菜单,把kernel-ml 4.9设为默认,重启

grub2-set-default 0

或者

# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (4.9.0-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-514.2.2.el7.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-327.36.3.el7.x86_64) 7 (Core)
3 : CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)
4 : CentOS Linux (0-rescue-d67c340e997845be9d763958bab035d6) 7 (Core)
# 查看当前设置
# grub2-editenv list
saved_entry=0
# grub2-set-default 0
# reboot 

安装gcc

yum install gcc-c++
wget https://cmake.org/files/v3.7/cmake-3.7.0.tar.gz
tar xf cmake-3.7.0.tar.gz
cd cmake-3.7.0
./configure
make -j $THREADS
sudo make install
cd ..

安装bison

curl -OL https://ftp.gnu.org/gnu/bison/bison-3.0.tar.xz
tar -xf bison-3.0.tar.xz
cd bison-3.0
./configure
make -j $THREADS
sudo make install
cd ..

Build CLANG

curl -LO http://releases.llvm.org/3.9.1/cfe-3.9.1.src.tar.xz
curl -LO http://releases.llvm.org/3.9.1/llvm-3.9.1.src.tar.xz
tar -xf cfe-3.9.1.src.tar.xz
tar -xf llvm-3.9.1.src.tar.xz
mkdir clang-build
mkdir llvm-build

cd llvm-build
cmake -G "Unix Makefiles" -DLLVM_TARGETS_TO_BUILD="BPF;X86" \
  -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ../llvm-3.9.1.src
make -j $THREADS
sudo make install

cd ../clang-build
cmake -G "Unix Makefiles" -DLLVM_TARGETS_TO_BUILD="BPF;X86" \
  -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ../cfe-3.9.1.src
make -j $THREADS
sudo make install
cd ..

下载BCC的依赖


sudo yum install -y elfutils-libelf-devel flex
安装bcc bcc-tools
 yum --enablerepo=elrepo-kernel install bcc bcc-tools

 原文链接https://www.jianshu.com/p/997e0a6d8e09

扫码领视频副本.gif

0

上一篇:

:下一篇

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号