OPENVSWITCH LTS IN CENTOS 6

As some visitors have asked me about installing Open vSwitch on CentOS 6, I’m writing the following post after my first about it almos three years ago. If you find a better way, please let me know so I update the post and remove useless info from the Internet 😉

I’ve found this repository by Alexander Evseev so you may try to use the openvswitch packages (you even have the kmod package) found there. Have a look: http://download.opensuse.org/repositories/home:/aevseev/CentOS6/x86_64/

In any case… I’ll show you what you can do to generate your own RPM packages the old way (no python api supported as it requires Python 2.7 while CentOS 6 uses Python 2.6):

Current LTS version: 2.5.0
Tested on: CentOS 6.8

Let’s start installing some packages:

yum -y install wget openssl-devel gcc make python-devel openssl-devel kernel-devel graphviz kernel-debug-devel autoconf automake rpm-build redhat-rpm-config libtool python-twisted-core python-zope-interface PyQt4 desktop-file-utils libcap-ng-devel groff checkpolicy selinux-policy-devel

Let’s add a new user and switch to that user:

adduser ovs; su - ovs

Let’s prepare the build environment and download the source code:

mkdir -p ~/rpmbuild/SOURCES
wget http://openvswitch.org/releases/openvswitch-2.5.0.tar.gz
cp openvswitch-2.5.0.tar.gz ~/rpmbuild/SOURCES/
tar xfz openvswitch-2.5.0.tar.gz

Now go to the openvswitch directory

cd openvswitch-2.5.0

Let’s modify some lines in the old rhel6 spec file provided by Nicira (copy and paste):

sed -i "s/Requires: logrotate, python >= 2.7/Requires: logrotate/" rhel/openvswitch.spec
sed -i "/$RPM_BUILD_ROOT\/usr\/bin\/ovs-test/d" rhel/openvswitch.spec
sed -i "/$RPM_BUILD_ROOT\/usr\/bin\/ovs-l3ping/d" rhel/openvswitch.spec
sed -i "/\/usr\/bin\/ovs-parse-backtrace/d" rhel/openvswitch.spec
sed -i "/\/usr\/bin\/ovs-pcap/d" rhel/openvswitch.spec
sed -i "/\/usr\/bin\/ovs-tcpundump/d" rhel/openvswitch.spec
sed -i "/\/usr\/bin\/ovs-vlan-test/d" rhel/openvswitch.spec
sed -i "/\/usr\/share\/man\/man8\/ovs-bugtool.8.gz/d" rhel/openvswitch.spec
sed -i "/\/usr\/share\/openvswitch\/bugtool-plugins/d" rhel/openvswitch.spec
sed -i "/\/usr\/share\/openvswitch\/scripts\/ovs-bugtool-*/d" rhel/openvswitch.spec
sed -i "/\/usr\/share\/openvswitch\/python/d" rhel/openvswitch.spec
sed -i "/\/usr\/share\/openvswitch\/scripts\/ovs-bugtool-*/d" rhel/openvswitch.spec
sed -i "/\/usr\/bin\/ovs-dpctl-top/d" rhel/openvswitch.spec
sed -i "/\/usr\/sbin\/ovs-bugtool/d" rhel/openvswitch.spec
echo "/usr/bin/ovs-testcontroller" >> rhel/openvswitch.spec

Finally let’s build the RPM packages… and have a cup of coffee as tests are being run! At least you can tell if it works… 😛

rpmbuild -bb rhel/openvswitch.spec

Once the build is finished, type exit.

exit

CentOS 6 already provides an openvswitch kernel module, so we’ve only compiled the binary tools.

[root@localhost ~]# modinfo openvswitch
filename: /lib/modules/2.6.32-642.3.1.el6.x86_64/kernel/net/openvswitch/openvswitch.ko
license: GPL
description: Open vSwitch switching datapath
srcversion: 00938868C288DBF055E30F3
depends: libcrc32c,vxlan
vermagic: 2.6.32-642.3.1.el6.x86_64 SMP mod_unload modversions

As root, we’ll install the RPM package.

 yum localinstall /home/ovs/rpmbuild/RPMS/x86_64/openvswitch-2.5.0-1.x86_64.rpm -y

Finally, start the openvswitch service and check that it’s running

service openvswitch start
...output...
/etc/openvswitch/conf.db does not exist ... (warning).
Creating empty database /etc/openvswitch/conf.db [ OK ]
Starting ovsdb-server [ OK ]
Configuring Open vSwitch system IDs [ OK ]
Inserting openvswitch module [ OK ]
Starting ovs-vswitchd [ OK ]
Enabling remote OVSDB managers [ OK ]

service openvswitch status
...output...
ovsdb-server is running with pid 3404
ovs-vswitchd is running with pid 3416

If you want the openvswitch service to start at boot time:

chkconfig openvswitch on

Let’s check that the command-line tools are ready:

ovs-vsctl -V
...output...
ovs-vsctl (Open vSwitch) 2.5.0
Compiled Aug 31 2016 19:54:41
DB Schema 7.12.1

Done. I can’t be sure if it will work for you as I haven’t been using Open vSwitch with CentOS 6 for a long time… so any feedback is welcomed!

Cheers!

Advertisements

7 thoughts on “OPENVSWITCH LTS IN CENTOS 6

  1. Gilbert Standen says:

    Thanks for this guide, I will try it out and provide feedback. I have a guide for building OpenvSwitch on Oracle Linux 6 UEK here https://sites.google.com/site/nandydandyoracle/openvswitch-ovs/build-openvswitch-from-source-on-oracle-linux-uek which should be very similar to Centos6 but I notice that your guide makes no mention of the python version issue that must be addressed on Oracle6 UEK so I’m guessing that UEK and CentOS6 have different python versions. BTW I also have a guide here https://sites.google.com/site/nandydandyoracle/centos7/centos7-general/openvswitch-source-build-centos7 for building OpenvSwitch on CentOS7.

    Like

  2. Attila Ruzsinszky says:

    Hi,

    My test process is waiting (or doing?) something at here:

    1727: ovn-controller-vtep – test chassis skipped (ovn-controller-vtep.at:113)
    1728: ovn-controller-vtep – test binding 1 skipped (ovn-controller-vtep.at:180)
    1729: ovn-controller-vtep – test binding 2 skipped (ovn-controller-vtep.at:244)
    1730: ovn-controller-vtep – test vtep-lswitch skipped (ovn-controller-vtep.at:283)
    1731: ovn-controller-vtep – test vtep-macs 1 skipped (ovn-controller-vtep.at:335)
    1732: ovn-controller-vtep – test vtep-macs 2 skipped (ovn-controller-vtep.at:406)

    How long does it take?

    TIA,

    Like

    • n40lab says:

      Doing…be patient a cup of coffee would be not enough 😅 If something breaks it will show an error. If everything is fine the rpm package will be built. I didn’t find how to skip the testing with rpmbuild but the tests should finish. Thanks for the feedback

      Like

  3. Attila Ruzsinszky says:

    Hi,

    More than a day is enough?

    root 30635 0.0 0.0 12680 2212 pts/4 T szept02 0:00 /bin/sh ./tests/testsuite -C tests AUTOTEST_PATH=utilities:vswitchd:ovsdb:vtep:tests::ovn/c
    root 30640 0.0 0.0 12680 2212 pts/4 T szept02 0:00 /bin/sh ./tests/testsuite -C tests AUTOTEST_PATH=utilities:vswitchd:ovsdb:vtep:tests::ovn/c
    root 30641 0.0 0.0 12680 2196 pts/4 T szept02 0:00 /bin/sh ./tests/testsuite -C tests AUTOTEST_PATH=utilities:vswitchd:ovsdb:vtep:tests::ovn/c
    root 30642 0.0 0.0 4156 72 pts/4 T szept02 0:00 cat
    root 30644 0.0 0.0 12680 2132 pts/4 T szept02 0:00 /bin/sh ./tests/testsuite -C tests AUTOTEST_PATH=utilities:vswitchd:ovsdb:vtep:tests::ovn/c
    root 30647 0.0 0.0 25252 1900 pts/4 T szept02 0:00 /usr/bin/perl

    I think this do nothing.

    TIA,

    Like

    • n40lab says:

      No, of course not. It took 5 to 10 minutes so something does not work right. Maybe trying to download CentOS 6.4 and compile the package would work, let me know how I may help.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s