更新到最新 CentOS 7.3 1611
yum update -y
cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
安装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,只保留内核,
然后 yum --enablerepo=elrepo-kernel install kernel-ml
就会安装elrepo正式版4.9内核,跟着再安装kernel-ml-headers kernel-ml-tools kernel-ml-tools-libs
yum --enablerepo=elrepo-kernel install kernel-ml-headers kernel-ml-tools kernel-ml-tools-libs
然后
grub2-mkconfig -o /boot/grub2/grub.cfg
生成启动菜单,把kernel-ml 4.9设为默认,参考下面技巧,然后重启
# 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
安装sysdig
curl -s https://s3.amazonaws.com/download.draios.com/stable/install-sysdig | sudo bash
安装bcc-tools
yum install -y bison ethtool flex git iperf libstdc++-static \
python-netaddr python-pip gcc gcc-c++ make zlib-devel \
elfutils-libelf-devel
yum install -y luajit luajit-devel # for Lua support
yum install -y http://dl.marmotte.net/rpms/redhat/el7/x86_64/netperf-2.6.0-1.el7/netperf-2.6.0-1.el7.x86_64.rpm
pip install pyroute2
安装依赖包:
cd /root
yum install -y git gcc gcc-c++
安装cmake3.7
wget https://cmake.org/files/v3.7/cmake-3.7.1.tar.gz
tar -xf cmake-3.7.1.tar.gz
cd cmake-3.7.1
./bootstrap
gmake
make install
echo 'export PATH=$PATH:/usr/local/bin' >> ~/.bashrc
source ~/.bashrc
安装llvm3.9
cd /root
wget http://releases.llvm.org/3.9.1/llvm-3.9.1.src.tar.xz
tar -xf llvm-3.9.1.src.tar.xz
wget http://releases.llvm.org/3.9.1/cfe-3.9.1.src.tar.xz
tar -xf cfe-3.9.1.src.tar.xz
mv cfe-3.9.1.src llvm-3.9.1.src/tools/
mkdir llvm-build
cd llvm-build
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local -DLLVM_TARGETS_TO_BUILD="BPF;X86" -DCMAKE_BUILD_TYPE=Release ../llvm-3.9.1.src
make
make install
编译的时间稍微有点儿长。
安装bcc-tools
cd /root
git clone https://github.com/iovisor/bcc.git
mkdir bcc-build
cd bcc-build
cmake -DCMAKE_INSTALL_PREFIX=/usr ../bcc
make
make install
编译也不快,因为我用的虚拟机吧。
安装完成时候就可以到 /usr/share/bcc/tools 目下体验bbc-tools的强大了。