Skip to content

Instantly share code, notes, and snippets.

@olegslavkin
Last active June 20, 2022 12:08
Show Gist options
  • Save olegslavkin/af989e7a850eb67fa779 to your computer and use it in GitHub Desktop.
Save olegslavkin/af989e7a850eb67fa779 to your computer and use it in GitHub Desktop.
Install Openvswitch from source (Ubuntu 14.04.3 Server)
!#/bin/bash
# Install openvswitch Ubuntu 14.04.3
# Author: Oleg Slavkin (oleg@slavkin.info)
echo "-------------------------------"
echo "Step 1. Install git package"
echo "-------------------------------"
sudo apt-get update
sudo apt-get -y install git
echo "Step 2. Clone Openvswitch git Repo"
git --depth=1 clone https://github.com/openvswitch/ovs.git
echo "Step 3. Install tools"
sudo apt-get -y install autoconf libtool make
echo "Step 4. Build OvS"
cd ovs/
./boot.sh
./configure --with-linux=/lib/modules/`uname -r`/build
make
echo "Step 5. Install OpenVswitch"
sudo make install
sudo make modules_install
echo "Step 6. Create OvS Database"
sudo ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema
echo "Step 7. Run OvS..."
sudo ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \
--remote=db:Open_vSwitch,Open_vSwitch,manager_options \
--private-key=db:Open_vSwitch,SSL,private_key \
--certificate=db:Open_vSwitch,SSL,certificate \
--bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert \
--pidfile --detach
sudo ovs-vsctl --no-wait init
sudo ovs-vswitchd --pidfile --detach
@S-IMEN
Copy link

S-IMEN commented Aug 3, 2018

Sir , how can i solved it ?
~$ sudo mn
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2
*** Adding switches:
ovs-vsctl: unix:/usr/local/var/run/openvswitch/db.sock: database connection failed (No such file or directory)
ovs-vsctl exited with code 1
*** Error connecting to ovs-db with ovs-vsctl
Make sure that Open vSwitch is installed, that ovsdb-server is running, and that
"ovs-vsctl show" works correctly.
You may wish to try "service openvswitch-switch start".

Cdt,

@r3dw0lf
Copy link

r3dw0lf commented Jan 7, 2020

Hi,
you can use the following command to create your database:
/usr/share/openvswitch/scripts/ovs-ctl start
any time you needed you can use the following command to restart the connection from your OVS to controller:
/usr/share/openvswitch/scripts/ovs-ctl restart

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