Step1:安装依赖
[root@VSW2 ~]# yum install gcc pkgconfig autoconf automake libtool git make python-devel openssl-devel kernel-devel kernel-debug-devel
Step2:下载源码
[root@VSW2 ~]# wget http://openvswitch.org/releases/openvswitch-2.8.1.tar.gz
[root@VSW2 ~]# tar zxvf openvswitch-2.8.1.tar.gz
Step3:编译安装
[root@VSW2 ~]# cd openvswitch-2.8.1
[root@VSW2 openvswitch-2.8.1]# ./configure --prefix=/usr/local/ovs
依赖处理:
configure: WARNING: cannot find libcap-ng.
--user option will not be supported on Linux.
(you may use --disable-libcapng to suppress this warning).
checking for Python 2.x for x >= 7... /usr/bin/python
checking whether /usr/bin/python has six library... configure: error: Missing Python six library or version too old.
解决方法:
[root@VSW2 openvswitch-2.8.1]# yum install python-six.noarch -y
[root@VSW2 openvswitch-2.8.1]# make -j 4
[root@VSW2 openvswitch-2.8.1]# make install
Step4:加载模块
[root@VSW2 openvswitch-2.8.1]# modprobe openvswitch
[root@VSW2 openvswitch-2.8.1]# lsmod | grep openvswitch
openvswitch 114793 0
nf_nat_ipv6 14131 1 openvswitch
nf_nat_ipv4 14115 1 openvswitch
nf_defrag_ipv6 35104 2 openvswitch,nf_conntrack_ipv6
nf_nat 26787 3 openvswitch,nf_nat_ipv4,nf_nat_ipv6
nf_conntrack 133095 6 openvswitch,nf_nat,nf_nat_ipv4,nf_nat_ipv6,nf_conntrack_ipv4,nf_conntrack_ipv6
libcrc32c 12644 4 xfs,openvswitch,nf_nat,nf_conntrack
[root@VSW2 openvswitch-2.8.1]#
Step5:修改环境变量
[root@VSW2 openvswitch-2.8.1]# vim /etc/profile
最后一行追加:
export PATH=/usr/local/ovs/share/openvswitch/scripts:/usr/local/ovs/bin:/usr/local/ovs/sbin:$PATH
[root@VSW2 openvswitch-2.8.1]# source /etc/profile