-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathessentials.sh
More file actions
executable file
·69 lines (57 loc) · 2.17 KB
/
Copy pathessentials.sh
File metadata and controls
executable file
·69 lines (57 loc) · 2.17 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
#!/usr/bin/env bash
set -euo pipefail
# Detect OS (Ubuntu / RHEL / CentOS / Rocky / AlmaLinux)
if [ -f /etc/os-release ]; then
. /etc/os-release
OS_ID=$ID
OS_VERSION_ID=$VERSION_ID
else
echo "❌ Cannot detect OS"
exit 1
fi
echo "Detected OS: $OS_ID $OS_VERSION_ID"
if [[ "$OS_ID" =~ (rhel|centos|rocky|almalinux) ]]; then
echo "➡ Installing dependencies for RHEL/CentOS family"
# Extract major version (e.g. 8, 9)
OS_MAJOR=$(echo "$OS_VERSION_ID" | cut -d. -f1)
# Install EPEL (automatically match major version)
EPEL_URL="https://dl.fedoraproject.org/pub/epel/epel-release-latest-${OS_MAJOR}.noarch.rpm"
echo "Downloading EPEL from: $EPEL_URL"
wget -q "$EPEL_URL" -O /tmp/epel-release.rpm
rpm -Uvh /tmp/epel-release.rpm
# Install packages
dnf -y --enablerepo=crb install protobuf-devel || true
dnf -y --enablerepo=devel install meson libconfig-devel protobuf-compiler || true
dnf -y install grpc grpc-cpp grpc-devel libpcap-devel
dnf -y install python3-pyelftools libxdp-devel and libbpf-devel
dnf -y install hwdata # provides /usr/share/*/pci.ids for NIC model lookup
elif [[ "$OS_ID" == "ubuntu" ]]; then
echo "➡ Installing dependencies for Ubuntu (tested on 24.04)"
apt-get update -y
apt-get install -y \
libnuma-dev \
git gcc make libtool-bin pkg-config pciutils pci.ids iproute2 \
kmod vim net-tools libconfig-dev libjsoncpp-dev \
cmake libcurl4-openssl-dev libssl-dev \
libgrpc++-dev protobuf-compiler-grpc libabsl-dev meson \
python3-pyelftools ninja-build python3-setuptools \
libcpprest-dev uuid-dev curl libarchive-dev \
librdkafka-dev libpcap-dev libsystemd-dev libxdp-dev libbpf-dev
apt-get clean -y
apt-get autoclean -y
apt-get autoremove -y
cd /tmp
git clone https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3.git
cd etcd-cpp-apiv3
TAG=$(git describe --tags --abbrev=0)
git checkout $TAG
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j"$(nproc)"
make install
ldconfig
else
echo "❌ Unsupported OS: $OS_ID"
exit 1
fi
echo "✅ Dependencies installed successfully."