1、下载安装包
wget http://openvswitch.org/releases/openvswitch-2.8.1.tar.gz
2、解压
tar -zxvf openvswitch-2.8.1.tar.gz
3、安装编译初始化
进入安装目录
./boot
./configure --with-linux=/lib/modules/`uname -r`/build
错误信息
configure: error: Missing Python six library or version too old
解决方法:
安装依赖
yum install python-six.noarch -y
后再执行又报错
configure: error: source dir /lib/modules/3.10.0-862.el7.x86_64/build doesn't exist
可能是kernel-devel依赖未安装,但是yum后提示已安装更高版本
于是,进入改目录关联最新的内核文件
cd /lib/modules/3.10.0-862.el7.x86_64/
rm -f build
ln -s /usr/src/kernels/3.10.0-1160.36.2.el7.x86_64/ ./build
4、执行编译安装
make
make install
make modules_install
/sbin/modprobe openvswitch
5、初始化数据库
ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema
ovsdb-server -v --remote=punix:/usr/local/var/run/openvswitch/db.sock --remote=db:Open_vSwitch,Open_vSwitch,manager_options --private-key=db:Open_vSwitch,SSL,private_key --certificate=db:Open_vSwitch,SSL,certificate --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --pidfile --detach
报错
ovsdb-server: /usr/local/var/run/openvswitch/ovsdb-server.pid.tmp: create failed (No such file or directory)
---------创建对应目录就行 /usr/local/var/run/openvswitch/
ovs-vsctl --no-wait init
报错
ovs-vsctl: unix:/var/run/openvswitch/db.sock: database connection failed (No such file or directory)
在/var/run/目录下关联 ln -s /usr/local/var/run/openvswitch/
6、启动ovs
ovs-vswitchd --pidfile --detach