Skip to content

Commit

Permalink
Add install steps for Alpine Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
acj authored and yonghong-song committed Jun 15, 2020
1 parent 10603c7 commit 2c93955
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions INSTALL.md
Expand Up @@ -10,13 +10,15 @@
- [RHEL](#rhel---binary)
- [Amazon Linux 1](#Amazon-Linux-1---Binary)
- [Amazon Linux 2](#Amazon-Linux-2---Binary)
- [Alpine](#alpine---binary)
* [Source](#source)
- [Debian](#debian---source)
- [Ubuntu](#ubuntu---source)
- [Fedora](#fedora---source)
- [openSUSE](#opensuse---source)
- [Centos](#centos---source)
- [Amazon Linux](#amazon-linux---source)
- [Alpine](#alpine---source)
* [Older Instructions](#older-instructions)

## Kernel Configuration
Expand Down Expand Up @@ -233,6 +235,36 @@ sudo yum install kernel-devel-$(uname -r)
sudo yum install bcc
```

## Alpine - Binary

As of Alpine 3.11, bcc binaries are available in the community repository:

```
sudo apk add bcc-tools bcc-doc
```

The tools are installed in `/usr/share/bcc/tools`.

**Python Compatibility**

The binary packages include bindings for Python 3 only. The Python-based tools assume that a `python` binary is available at `/usr/bin/python`, but that may not be true on recent versions of Alpine. If you encounter errors like `<tool-name>: not found`, you can try creating a symlink to the Python 3.x binary like so:

```
sudo ln -s $(which python3) /usr/bin/python
```

**Containers**

Alpine Linux is often used as a base system for containers. `bcc` can be used in such an environment by launching the container in privileged mode with kernel modules available through bind mounts:

```
sudo docker run --rm -it --privileged \
-v /lib/modules:/lib/modules:ro \
-v /sys:/sys:ro \
-v /usr/src:/usr/src:ro \
alpine:3.12
```

# Source

## libbpf Submodule
Expand Down Expand Up @@ -550,6 +582,35 @@ sudo mount -t debugfs debugfs /sys/kernel/debug
sudo /usr/share/bcc/tools/execsnoop
```

## Alpine - Source

### Install packages required for building

```
sudo apk add tar git build-base iperf linux-headers llvm10-dev llvm10-static \
clang-dev clang-static cmake python3 flex-dev bison luajit-dev elfutils-dev \
zlib-dev
```

### Build bcc

```
git clone https://github.com/iovisor/bcc.git
mkdir bcc/build; cd bcc/build
# python2 can be substituted here, depending on your environment
cmake -DPYTHON_CMD=python3 ..
make && sudo make install
# Optional, but needed if you don't have /usr/bin/python on your system
ln -s $(which python3) /usr/bin/python
```

### Test

```
sudo /usr/share/bcc/tools/execsnoop
```

# Older Instructions

## Build LLVM and Clang development libs
Expand Down

0 comments on commit 2c93955

Please sign in to comment.