在centos6中安装openvswitch需要一些技巧,因为最新版的v2.3.2无法通过yum包管理器的方式进行安装,只能编译。

$ sudo yum groupinstall "Development Tools" -y
$ sudo yum install rpmdevtools openssl-devel kernel-devel gcc redhat-rpm-config -y
$ sudo adduser ovswitch
$ su - ovswitch
$ cd ~
$ wget http://openvswitch.org/releases/openvswitch-2.3.2.tar.gz
$ tar xzf openvswitch-2.3.2.tar.gz
$ mkdir -p rpmbuild/SOURCES
$ cp openvswitch-2.3.2.tar.gz rpmbuild/SOURCES/
$ cp openvswitch-2.3.2/rhel/openvswitch-kmod.files /home/ovswitch/rpmbuild/SOURCES/
$ sed 's/openvswitch-kmod, //g' openvswitch-2.3.1/rhel/openvswitch.spec > openvswitch-2.3.2/rhel/openvswitch_no_kmod.spec
$ rpmbuild -bb openvswitch-2.3.2/rhel/openvswitch_no_kmod.spec
$ exit
$ sudo yum localinstall rpmbuild/RPMS/x86_64/openvswitch-2.3.2.x86_64.rpm
$ sudo modprobe openvswitch
$ sudo service openvswitch start