Berkely Packet Filter Installation. Easy todo on Ubuntu, had to install from source on Proxmox.
Virtual Servers - Ubuntu
sudo apt-get install bpfcc-tools linux-headers-$(uname -r)
I ended up writing an ansible role for these.
---
- name: Install required system packages
apt: name= state=latest update_cache=yes
loop: ['bpfcc-tools']
become: true
become_user: root
become_method: sudo
- name: Install linux headers
package:
name: "linux-headers-"
become: true
become_user: root
become_method: sudo
Physical Servers
I ran into a few issues with attempting to install bpf tooling and bcc on the proxmox servers I have with pve packages. I was unable to install them using apt install. I had to go the route of installing them by source. I was running kernel 5.34-1-pve.
# For Bionic (18.04 LTS)
sudo apt-get -y install bison build-essential cmake flex git libedit-dev \
libllvm6.0 llvm-6.0-dev libclang-6.0-dev python zlib1g-dev libelf-dev libfl-dev
Install and Compile BCC:
git clone https://github.com/iovisor/bcc.git
mkdir bcc/build; cd bcc/build
cmake ..
make
sudo make install
cmake -DPYTHON_CMD=python3 .. # build python3 binding
pushd src/python/
make
sudo make install
popd
Runnning from Docker
From the host shell:
docker run -it --rm \
--privileged \
-v /lib/modules:/lib/modules:ro \
-v /usr/src:/usr/src:ro \
-v /etc/localtime:/etc/localtime:ro \
--workdir /usr/share/bcc/tools \
zlim/bcc