如何在ubuntu22.04安装eBPF
Easul Lv6

安装这个的原因,主要是想要尝试一下 ecapture(点击跳转)。
在使用 ecapture 的时候,发现在监控系统内部的 HTTPS 请求时,没有安装 eBPF 内核。但因为在deepin编译内核的时候可能会因为一些误操作导致系统崩溃,遂选择使用KVM安装虚拟机后再进行尝试。

以下为一些命令行的操作

折叠代码块BASH 复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 先切换下国内的镜像源
# 这里我选择的是国内阿里的镜像源
#
# 备份原本镜像源
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
# 增加新的镜像源
sudo tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
EOF
# 更新相关仓库缓存
sudo apt-get update
# 安装git
sudo apt-get install git -y
# 创建存放文件夹
mkdir ~/software/
cd ~/software
# clone安装脚本
git clone https://github.com/mar0ls/bcc_ubuntu22.04_installer.git
# 进入脚本目录
cd bcc_ubuntu22.04_installer
# 给脚本授予权限
chmod +x bcc_installer.sh
# 运行脚本
# 运行的开始会让输入 root 密码,以供后续使用
# 因为换了软件源,所以安装还是很快的
./bcc_installer.sh
# 安装完之后下载ecapture
cd ~/software
wget https://github.com/gojue/ecapture/releases/download/v0.9.1/ecapture-v0.9.1-linux-amd64.tar.gz
tar -zxvf ecapture-v0.9.1-linux-amd64.tar.gz
cd ecapture-v0.9.1-linux-amd64
# 测试运行需要使用eBPF的命令
sudo ./ecapture tls

参考链接

其他没有实现效果的参考

相关问题记录

  • 无法安装 llvmclang 是因为没有更新源,更新之后就可以安装了
 评论
来发评论吧~
Powered By Valine
v1.5.2