How To Install bpftrace on CentOS 8

In this tutorial we learn how to install bpftrace on CentOS 8. bpftrace is High-level tracing language for Linux eBPF

Introduction

In this tutorial we learn how to install bpftrace on CentOS 8.

What is bpftrace

BPFtrace is a high-level tracing language for Linux enhanced Berkeley Packet Filter (eBPF) available in recent Linux kernels (4.x). BPFtrace uses LLVM as a backend to compile scripts to BPF-bytecode and makes use of BCC for interacting with the Linux BPF system, as well as existing Linux tracing capabilities (uprobes), and tracepoints. The BPFtrace language is inspired by awk and C, and predecessor tracers such as DTrace and SystemTap

We can use yum or dnf to install bpftrace on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install bpftrace.

Install bpftrace on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install bpftrace using yum by running the following command:

sudo yum -y install bpftrace

Install bpftrace on CentOS 8 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install bpftrace using dnf by running the following command:

sudo dnf -y install bpftrace

How To Uninstall bpftrace on CentOS 8

To uninstall only the bpftrace package we can use the following command:

sudo dnf remove bpftrace

References

Summary

In this tutorial we learn how to install bpftrace on CentOS 8 using yum and dnf.