From d5d67f24eaa4b1ac80073e74f29371e9aa10cede Mon Sep 17 00:00:00 2001 From: mozillazg Date: Sun, 20 Oct 2024 03:04:23 +0000 Subject: [PATCH] docs(deps): Update documentation regarding dependencies and Vagrantfile --- README.md | 18 +++++++++++++++++- Vagrantfile | 9 +++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a216a15..d0d413d 100644 --- a/README.md +++ b/README.md @@ -174,8 +174,23 @@ +### 开发环境 -源码目录: +开发环境如下: +* 系统:Ubuntu 22.04 +* 依赖 (安装和配置方法详见 [CI](https://github.com/mozillazg/cloud-native-security-with-ebpf/blob/master/.github/workflows/build.yml) ,也可以使用 [Vagrant](https://www.vagrantup.com/) 一键创建开发环境): + * Go >= 1.21 + * Clang/LLM 12 + * libelf-dev + * zlib1g-dev + * libzstd-dev + * pkgconf + * make + * git + * linux-tools-common linux-tools-generic linux-tools-$(uname -r) + * build-essential + +### 源码目录 | 章节 | 源代码 | @@ -229,3 +244,4 @@ | 14.3 探测和审计恶意 eBPF 程序 | | | 14.3.2 | [chapter14/inspect-ebpf-helpers](chapter14/inspect-ebpf-helpers) | | 14.3.3 | [chapter14/check-helper-call](chapter14/check-helper-call) | + diff --git a/Vagrantfile b/Vagrantfile index a59b930..9289285 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -3,7 +3,7 @@ Vagrant.configure("2") do |config| config.vm.box_version = "20220902.0.0" config.vm.disk :disk, size: "20GB" config.vm.synced_folder "../", "/home/vagrant/go/src/github.com/mozillazg/cloud-native-security-with-ebpf", create: true - config.ssh.extra_args = ["-t", "cd /home/vagrant/go/src/github.com/mozillazg/cloud-native-security-with-ebpf/chapter11; bash --login"] + config.ssh.extra_args = ["-t", "cd /home/vagrant/go/src/github.com/mozillazg/cloud-native-security-with-ebpf; bash --login"] config.vm.provider "virtualbox" do |v| v.memory = 2048 v.cpus = 2 @@ -11,21 +11,22 @@ Vagrant.configure("2") do |config| # install dependencies config.vm.provision "shell", inline: <<-SHELL - cd /home/vagrant/go/src/github.com/mozillazg/cloud-native-security-with-ebpf/chapter11 + cd /home/vagrant/go/src/github.com/mozillazg/cloud-native-security-with-ebpf sed -i "s@http://.*archive.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list sed -i "s@http://.*security.ubuntu.com@https://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list apt-get update apt-get update - apt-get install --yes build-essential pkgconf libelf-dev llvm-12 clang-12 linux-tools-$(uname -r) + apt-get install --yes build-essential pkgconf zlib1g-dev libelf-dev libzstd-dev llvm-12 clang-12 \ + linux-tools-common linux-tools-generic linux-tools-$(uname -r) for tool in "clang" "llc" "llvm-strip" do path=$(which $tool-12) ln -s -f $path ${path%-*} done - snap install go --channel=1.18/stable --classic + snap install go --channel=1.21/stable --classic chown vagrant -R /home/vagrant/go/ grep GOPROXY /home/vagrant/.bashrc || \ echo 'export GOPROXY=https://goproxy.cn,direct' >> /home/vagrant/.bashrc