Skip to content

Instantly share code, notes, and snippets.

@balioune
Last active November 24, 2021 10:09
Show Gist options
  • Save balioune/d63b32289256b667201954cda1309a03 to your computer and use it in GitHub Desktop.
Save balioune/d63b32289256b667201954cda1309a03 to your computer and use it in GitHub Desktop.
#!/bin/bash
# source https://software.intel.com/en-us/articles/set-up-open-vswitch-with-dpdk-on-ubuntu-server
# https://www.kernel.org/doc/Documentation/
sudo apt-get install gcc g++ make -y
sudo apt-get install -y gcc-multilib
sudo apt-get install -y libc6-dev
## DPDK INSTALL
cd /usr/src/
wget http://fast.dpdk.org/rel/dpdk-16.07.2.tar.xz
tar xf dpdk-16.07.2.tar.xz
export DPDK_DIR=/usr/src/dpdk-stable-16.07.2
# Configure and Install DPDK
export DPDK_TARGET=x86_64-native-linuxapp-gcc
export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET
make install T=$DPDK_TARGET DESTDIR=install
echo "Removing old ovs configuration."
sudo /etc/init.d/openvswitch-switch stop
sudo kill `cd /usr/local/var/run/openvswitch && cat ovsdb-server.pid ovs-vswitchd.pid`
sudo rm -rf /usr/local/var/run/openvswitch
sudo mkdir -p /usr/local/var/run/openvswitch
sudo rm -rf /usr/local/etc/openvswitch
sudo mkdir -p /usr/local/etc/openvswitch
sudo rm -rf /var/run/openvswitch
sudo mkdir -p /var/run/openvswitch
sudo rm -rf /etc/openvswitch
sudo mkdir -p /etc/openvswitch
sudo rm -rf /var/log/openvswitch
sudo mkdir -p /var/log/openvswitch
sudo rmmod openvswitch
sudo rmmod gre
sudo rmmod vxlan
sudo rmmod libcrc32c
sudo rmmod openvswitch
sudo dpkg --force-all --purge openvswitch-switch
sudo dpkg --force-all --purge openvswitch-common
sudo dpkg --force-all --purge openvswitch-datapath-dkms
sudo rm /tmp/ovsdb.txt
touch /tmp/ovsdb.txt
sudo rm /tmp/vswitch.txt
touch /tmp/vswitch.txt
git clone https://github.com/openvswitch/ovs.git
cd ovs
git checkout v2.6.1
make clean
./boot.sh
./configure --with-dpdk=$DPDK_BUILD
sudo make install
#sudo make uninstall
sudo apt-get install -y build-essential
sudo apt-get install -y fakeroot
sudo apt-get install -y debhelper
sudo apt-get install -y autoconf
sudo apt-get install -y automake
sudo apt-get install -y libssl-dev
sudo apt-get install -y bzip2
sudo apt-get install -y openssl
sudo apt-get install -y graphviz
sudo apt-get install -y python-all
sudo apt-get install -y procps
sudo apt-get install -y python-qt4
sudo apt-get install -y python-zopeinterface
sudo apt-get install -y python-twisted-conch
sudo apt-get install -y libtool
sudo apt-get install -y dh-autoreconf
echo "Checking Build Dependencies."
sudo dpkg-checkbuilddeps
if [ $? -gt 0 ]; then
echo "ERROR:Build Dependencies not met."
exit 1
fi
echo "Creating Debian Packages."
rm ../openvswitch-*.deb
rm ../python-openvswitch*.deb
DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary
if [ $? -gt 0 ]; then
echo "ERROR:Creating Debian packages failed."
exit 1
fi
echo "Installing kernel module using dkms."
sudo apt-get install -y linux-headers-`uname -r`
sudo apt-get install -y dkms
sudo dpkg --install ../openvswitch-datapath-dkms*
if [ $? -gt 0 ]; then
echo "ERROR:Installing openvswitch kernel module failed."
exit 1
fi
echo "Installing openvswitch userland packages."
sudo dpkg --install ../openvswitch-common*
sudo dpkg --install ../openvswitch-switch*
if [ $? -gt 0 ]; then
echo "ERROR:Installing openvswitch userland packages failed."
exit 1
fi
sudo /etc/init.d/openvswitch-switch restart
sudo lsmod | grep -i open
sudo update-rc.d -f openvswitch-switch remove
sudo update-rc.d openvswitch-switch defaults
####
## Setup OVS with DPDK datapath
echo 'vm.nr_hugepages=2048' > /etc/sysctl.d/hugepages.conf
sysctl -w vm.nr_hugepages=2048
grep HugePages_ /proc/meminfo
sudo ovs-vsctl show
echo "Install Complete!"
@DogTailGrass
Copy link

Is the .deb packages include libdpdk?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment