How to install OpenvSwitch in Ubuntu


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 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


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/ --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/ --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

Was this answer helpful?