-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_ubuntu.sh
More file actions
executable file
·109 lines (89 loc) · 2.66 KB
/
install_ubuntu.sh
File metadata and controls
executable file
·109 lines (89 loc) · 2.66 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# Ubuntu installation script for BPF multicast program
# This script will install all necessary dependencies and set up the environment
set -e
echo "=== BPF Multicast Program - Ubuntu Installation ==="
echo
# Check if running as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root (use sudo)"
exit 1
fi
# Update package list
echo "Updating package list..."
apt update
# Install essential build tools
echo "Installing build tools..."
apt install -y build-essential
# Install LLVM and Clang
echo "Installing LLVM and Clang..."
apt install -y clang llvm
# Install BPF development libraries
echo "Installing BPF development libraries..."
apt install -y libbpf-dev libelf-dev
# Install kernel headers
echo "Installing kernel headers..."
apt install -y linux-headers-$(uname -r)
# Install architecture-specific headers
echo "Installing architecture-specific headers..."
apt install -y linux-libc-dev
# Install bpftool
echo "Installing bpftool..."
apt install -y bpftool
# Install additional useful tools
echo "Installing additional tools..."
apt install -y iproute2 net-tools tcpdump
echo
echo "=== Dependencies Installation Complete ==="
echo
# Check if BPF filesystem is mounted
if [[ ! -d "/sys/fs/bpf" ]]; then
echo "Mounting BPF filesystem..."
mount -t bpf bpf /sys/fs/bpf
echo "BPF filesystem mounted at /sys/fs/bpf"
else
echo "✓ BPF filesystem already mounted"
fi
# Make BPF filesystem mount persistent
if ! grep -q "bpf.*bpf.*/sys/fs/bpf" /etc/fstab; then
echo "Adding BPF filesystem to /etc/fstab for persistence..."
echo "bpf bpf /sys/fs/bpf bpf defaults 0 0" >> /etc/fstab
echo "✓ BPF filesystem will be mounted automatically on boot"
else
echo "✓ BPF filesystem already in /etc/fstab"
fi
echo
echo "=== Environment Setup Complete ==="
echo
# Verify installation
echo "Verifying installation..."
if command -v clang >/dev/null 2>&1; then
echo "✓ Clang: $(clang --version | head -n1)"
else
echo "✗ Clang not found"
fi
if command -v bpftool >/dev/null 2>&1; then
echo "✓ bpftool: $(bpftool version | head -n1)"
else
echo "✗ bpftool not found"
fi
if [[ -d "/sys/fs/bpf" ]]; then
echo "✓ BPF filesystem mounted"
else
echo "✗ BPF filesystem not mounted"
fi
echo
echo "=== Installation Summary ==="
echo "✓ Build tools installed"
echo "✓ LLVM/Clang installed"
echo "✓ BPF libraries installed"
echo "✓ Kernel headers installed"
echo "✓ bpftool installed"
echo "✓ BPF filesystem mounted"
echo
echo "You can now:"
echo "1. Compile the program: make"
echo "2. Test the setup: ./test_setup.sh"
echo "3. Load the program: sudo make load"
echo
echo "For more information, see README.md"