Last active
July 30, 2021 05:49
-
-
Save posoo/a002ad62913ae81caa334b4c270c52ed to your computer and use it in GitHub Desktop.
Install DPDK 20.02 on Ubuntu 18.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check architecture and kernel version | |
if [[ ! $(uname -m) == "x86_64" ]] | |
then | |
echo "Only support x86_64 architecture" | |
exit 1 | |
fi | |
if [[ ! $(uname -r) =~ ^4.15.* ]] | |
then | |
echo "Only support kernel version 4.15.*" | |
exit 1 | |
fi | |
# set -xe | |
# Install DPDK on your $HOME directory | |
CWD=$(pwd) | |
cd $HOME | |
# Install dependencies and utils | |
sudo apt update | |
sudo apt install -y --no-install-recommends --fix-missing \ | |
libelf-dev \ | |
build-essential \ | |
pkg-config \ | |
zlib1g-dev \ | |
libnuma-dev \ | |
vim \ | |
htop \ | |
tmux \ | |
wget \ | |
python \ | |
python3-dev \ | |
python3-setuptools \ | |
python3-pip | |
# Since meson packaged with bionic is outdated, install the latest meson & ninja through pypi | |
pip3 install wheel meson ninja | |
source $HOME/.bashrc | |
source $HOME/.profile | |
# Build and install DPDK | |
wget -qO- "https://fast.dpdk.org/rel/dpdk-20.02.1.tar.xz" | tar xJf - --transform "s/^dpdk-.*20\.02\.1/DPDK/" | |
cd DPDK | |
meson build | |
cd build | |
ninja | |
sudo env "PATH=$PATH" ninja install | |
sudo ldconfig | |
cd ../.. | |
# Set environments | |
echo "export RTE_SDK=$HOME/DPDK" >> $HOME/.bashrc | |
echo "export RTE_TARGET=x86_64-native-linux-gcc" >> $HOME/.bashrc | |
source $HOME/.bashrc | |
# Check if libdpdk can be found | |
dpdk_version=$(pkg-config --modversion libdpdk) | |
if [[ -z $dpdk_version ]] | |
then | |
echo "Failed to install DPDK. libdpdk cannot be found" | |
exit 1 | |
fi | |
# Wrap-up | |
echo "Successfully installed DPDK:$dpdk_version" | |
echo "Please reserve Hugepages for DPDK use" | |
echo "Ref: https://doc.dpdk.org/guides-20.02/linux_gsg/sys_reqs.html#use-of-hugepages-in-the-linux-environment" | |
echo "Please install correct drivers according to your hardware" | |
echo "Ref: https://doc.dpdk.org/guides-20.02/linux_gsg/linux_drivers.html" | |
echo "Finally, bind your interfaces through dpdk-devbind.py" | |
# Go back to $CWD | |
cd $CWD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment