-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add /docs/INSTALL-CENTOS.md #462
Comments
http://hydandata.org/installing-ebpf-tools-bcc-and-ply-on-centos-7 but no Lua support. I will get a PR together when I have a bit more time. |
hello, are there any up-to-date docs how to install this on centos 7? The http://hydandata.org/installing-ebpf-tools-bcc-and-ply-on-centos-7 is outdated, i get this error when following that tutorial: |
Also, would it be possible to use it from a fedora based docker container or a chroot on centos7? |
@dimovnike If you can show the detailed error messages on your centos 7 installation, folks here may be able to help. Yes, it is possible to use it inside a container. However, some tools esp. PID based filtering may not work properly inside the container. |
i get this error when compiling clang:
is there a way to use another version that is compatible with centos7 glibc? |
@dimovnike looks like issue with LD_LIBRARY_PATH, make sure it contains the path from the warning before you compile. If not, export it with the path added, ldconfig. |
I submitted pull request to merge little changes needed for CentOS 6 support. # Pre-requisites:
# 1) Configure SUDO
# 2) Set up http_proxy and https_proxy for build user and for root (via .bashrc)
# if there is no direct internet connection
# Install GIT
sudo yum install git
# Create build folder:
cd
mkdir build
cd build
# Detect number of threads
export THREADS=$(grep -c ^processor /proc/cpuinfo)
# Install kernel 4.9.71 from source
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.9.71.tar.xz
tar -xf linux-4.9.71.tar.xz
cd linux-4.9.71
# MANUAL copy .config
# you can download recent kernel from Elrepo, take config from there and use "make olddefconfig"
# however Elrepo 4.14 kernel doesn't appear to work with BCC on CentOS 6
# kernel 4.9 works just fine
# build kernel
make -j $THREADS
sudo make modules_install
sudo make install
sudo dracut --force /boot/initramfs-4.9.71.img 4.9.71
cd ..
# Install GCC
sudo yum install gcc-c++
# Install cmake
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 ..
# Install Python 2.7
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz
tar xf Python-2.7.12.tar.xz
cd Python-2.7.12
./configure
make -j $THREADS
sudo make altinstall
cd ..
# Install 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 ..
# Install GCC 6
sudo yum install https://rpmfind.net/linux/centos/6.9/extras/x86_64/Packages/centos-release-scl-rh-2-3.el6.centos.noarch.rpm --nogpgcheck
sudo yum install devtoolset-6
export CC=/opt/rh/devtoolset-6/root/usr/bin/gcc
export CXX=/opt/rh/devtoolset-6/root/usr/bin/g++
# 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 ..
# Install packages needed for BCC build
sudo yum install -y elfutils-libelf-devel flex
# Download BCC
git clone https://github.com/iovisor/bcc.git
# MANUAL! Apply patch bcc_rhel6.patch
# Not needed if CentOS 6 support pull request is already merged
# Build BCC
export CFLAGS=-I${HOME}/build/linux-4.9.71/usr/include
mkdir bcc-build
cd bcc-build
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr ../bcc
make -j $THREADS
sudo make install
# Copy bcc package for python 2.7
sudo cp -r /usr/lib/python2.6/site-packages/bcc /usr/local/lib/python2.7/site-packages/bcc
# MANUAL! Mount DEBUGFS in fstab:
#debugfs /sys/kernel/debug debugfs defaults 0 0
# or
mount -t debugfs debugfs /sys/kernel/debug
# You can start tools under root using command line like this:
#/usr/local/bin/python2.7 /usr/share/bcc/tools/offcputime <args> |
@samofatov Thanks, can you or anyone here confirm that this works on Centos 7 too? |
I have BCC installed on CentOS 7 based machines, but I didn't make a write up for that.
|
BTW, with |
@samofatov @hydandata I can't find python package for bcc on centos7. Anything wrong ? |
Finally I got it. First I compiled llvm-7.0 and bcc on centos7 kernel 3.10 and installed to a customized path /opt/bcc( It turned out that bcc could be compiled under kernel 3.10 ?). Then I copied the binaries to centos 7 kernel 5.0, and made the following two settings:
Then executing scripts under share/bcc/tools has no problem. |
|
A much simpler way to get bcc running in centos-7 is with the following commands:
The only caveat with this method is that you must enable the scl environment every time you want to run bcc. Scl environments are meant to be enabled with the above command, but it is possible to enable an scl environment without spawning a new shell with the following command:
This will enable the scl environment in the current shell which is useful for situations where you want to run bcc tools from within a script, or even to permanently enable a particular scl as documented here: |
@speas038 your instruction works for me, except one typo: |
@kylezh could you submit a patch to fix this typo? Thanks! |
@yonghong-song The typo I mentioned is in the @speas038 's comment #462 (comment), but not in the current code base. However, I would like to submit a patch that contains those instructions. |
Are there any concrete steps on CentOS7 based on kernel 3.10? |
Should work, provided the kernel is new enough (at least 4.1). If you've figured out the install steps, please drop comments here or a pull request.
Linux to this new file from /INSTALL.md .
The text was updated successfully, but these errors were encountered: