1.安裝依賴軟件包,及建立普通用戶ovs。
yum -y install wget gcc make python-devel openssl-devel kernel-devel graphviz kernel-debug-devel autoconf automake rpm-build redhat-rpm-config libtoolpython
adduser ovs
su - ovslinux
2.下載源碼包,並建立rpm包。
mkdir -p ~/rpmbuild/SOURCES
wget http://openvswitch.org/releases/openvswitch-2.3.2.tar.gz
cp openvswitch-2.3.2.tar.gz ~/rpmbuild/SOURCES/
tar xfz openvswitch-2.3.2.tar.gz
sed 's/openvswitch-kmod, //g' openvswitch-2.3.2/rhel/openvswitch.spec > openvswitch-2.3.2/rhel/openvswitch_no_kmod.spec
rpmbuild -bb --nocheck openvswitch-2.3.2/rhel/openvswitch_no_kmod.spec
exitui
3.建立ovs配置目錄,並安裝製做好的rpm包。
mkdir /etc/openvswitch
cd /home/ovs/rpmbuild/RPMS/x86_64/
yum install *spa
4.若是selinux開啓,請執行以下操做,如未開啓,請略過此步驟。
yum install policycoreutils-python
semanage fcontext -a -t openvswitch_rw_t "/etc/openvswitch(/.*)?"
restorecon -Rv /etc/openvswitchdebug
5.啓動服務,並查看ovs版本信息。rest
chkconfig openvswitch on
systemctl restart openvswitch.service
ovs-vsctl -Vssl