How to install OpenvSwitch in Ubuntu

3
 

Direct installation

Run these commands

sudo apt update
sudo apt upgrade
sudo apt install openvswitch-switch

Then start the ovs deamon

sudo ovs-vswitchd

Manual installation

1. Download OpenvSwitch

Create a directory (folder) in your Desktop called ovs then download https://www.openvswitch.org/releases/openvswitch-2.5.6.tar.gz from OpenVSwitch website and save it in the ovs folder. This is important because of step 3 below.

Extract it by right clicking on it and selecting extract or run the commands below in the terminal one at a time:

cd ~/Desktop/ovs/
tar -xvf openvswitch-2.5.6.tar.gz

2. Install dependencies

OpenVSwitch requires some dependencies installed first. Run this command in the terminal:

sudo apt install build-essential fakeroot graphviz autoconf automake bzip2 debhelper dh-autoreconf libssl-dev libtool openssl procps python-all python-qt4 python-twisted-conch python-zopeinterface module-assistant dkms make libc6-dev python-argparse uuid-runtime netbase kmod python-twisted-web iproute2 ipsec-tools openvswitch-switch racoon

Confirm if all dependencies are installed. The command below should return nothing if all are installed. Otherwise it will tell you which ones are missing. This command should be run inside the openvswitch directory extracted above:

sudo dpkg-checkbuilddeps

3. Generated OpenVSwitch .deb files

You have two options, use either of the commands below depending on whether you want to run the unit tests or not.

a. Run the unit tests

sudo fakeroot debian/rules binary

b. Don't run the unit tests

sudo DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary

This will generate the following debs in the ~/Desktop

openvswitch-common_2.5.6-1_amd64.deb
openvswitch-datapath-dkms_2.5.6-1_all.deb
openvswitch-datapath-source_2.5.6-1_all.deb
openvswitch-dbg_2.5.6-1_amd64.deb
openvswitch-ipsec_2.5.6-1_amd64.deb
openvswitch-pki_2.5.6-1_all.deb
openvswitch-switch_2.5.6-1_amd64.deb
openvswitch-test_2.5.6-1_all.deb
openvswitch-testcontroller_2.5.6-1_amd64.deb
openvswitch-vtep_2.5.6-1_amd64.deb

4. Install the generated deb files

The most important ones are openvswitch-common and openvswitch-switch. The rest can be installed depending on your exact needs.

cd ~/Desktop
sudo dpkg -i ../openvswitch-common_2.5.6-1_amd64.deb
sudo dpkg -i ../openvswitch-switch_2.5.6-1_amd64.deb

The openvswitch daemon called ovs-vswitchd will run automatically. You can confirm using:

ps -ef | grep ovs

Which should return such an output

ovsdb-server: monitoring pid 24477 (healthy)
ovsdb-server /etc/openvswitch/conf.db -vconsole:emer -vsyslog:err -vfile:info --remote=punix:/var/run/openvswitch/db.sock --private-key=db:Open_vSwitch,SSL,private_key --certificate=db:Open_vSwitch,SSL,certificate --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --no-chdir --log-file=/var/log/openvswitch/ovsdb-server.log --pidfile=/var/run/openvswitch/ovsdb-server.pid --detach --monitor
ovs-vswitchd: monitoring pid 24487 (healthy)
ovs-vswitchd unix:/var/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --no-chdir --log-file=/var/log/openvswitch/ovs-vswitchd.log --pidfile=/var/run/openvswitch/ovs-vswitchd.pid --detach --monitor

Unless it isn't running, you can manually start it using:

sudo ovs-vswitchd

5. Documentation

This information plus the documentation can be found at http://www.openvswitch.org/support/dist-docs-2.5/


Was this answer helpful?