Steps to Install Open VSwitch

The Lore

I was trying to run a mininet python script, but I got an error saying that, I did not have Open VSwitch installed.

So I was like, "Sigh I have to install this stuff now, it's probably going to be an annoying process, I should write down the steps"

In response to my dis-organised but orderly thoughts, these are the steps to install Open VSwitch on Ubuntu (or any Debian Linux Distro)

If you'll prefer a video guide, check here

But I'd recommend following this one

Step 1:

Download the latest release of openvswitch LTS here

The current LTS as of time of writing is openvswitch-2.17.10

Step 2:

Extract the folder to your ~/Documents directory and cd to that location (PS. you can actually extract it to any directory you want, but I just want to save you the stress of making a decision)

Step 3:

Install the build-essential ad fakeroot packages

(sdn-env) gift@console:~/Documents/openvswitch-2.17.10$ sudo apt-get install build-essential fakeroot

Step 4:

Next we would need to install the build dependencies under Build-Depends: in the debian/control file.

If you check the debian/control file you can see the Build-Depends at the top of the file like so:

openvswitch-debian-control.png

You might have some of these dependencies installed already. To check the dependencies you'll really need to install, just run this command:

(sdn-env) gift@console:~/Documents/openvswitch-2.17.10$ dpkg-checkbuilddeps

If this command returns nothing, it means you have already installed all the dependencies. If it returns some packages/libraries, you should go ahead and install them with apt-get.

I'm using Debian here because the OS I'm currently using is Ubuntu (Debian)

Step 5:

Now we have to build the openvswitch packages

(sdn-env) gift@console:~/Documents/openvswitch-2.17.10$ fakeroot debian/rules binary
This will take a while to build

in my case it took about 40 minutes to build and run all the unit tests.

But if you're in a hurry, you can build them in parallel like so:

$ DEB_BUILD_OPTIONS='parallel=8' fakeroot debian/rules binary`

You can even skip the unit tests to save even more time:

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

Step 6:

When the build command is done, the .deb files would be in the parent directory of the Open VSwitch folder, in our case it'll be in the ~/Documents directory.
We would install the .deb files with the sudo dpkg -i command.

But before we do that, if you check the ~/Documents directory, you would see that there are a lot of openvswitch .deb files, you typically would only need to install about three of them in a particular order:

If you need to install any other of the files depending on your use case, you can.
For my case I needed to install the python3-openvswitch_2.17.10-1_all.deb file, so I did.

And that's all for installing Open VSwitch on Debian Linux Distros.

Bye Bye (^_^ )