linux下快速安裝和卸載open-vswitch的操作方法介紹
一. ovs 從源碼編譯安裝:
安裝依賴項:
# apt install make
# apt install gcc
# apt install build-essential
# apt install libssl-dev
# apt install libcap-ng-dev
# apt install python2.7
# apt install python-pip
# pip install six
# apt install autoconf
# apt install automake
# apt install libtool
下載源碼包
# apt install git
# git clone https://github.com/openvswitch/ovs.git(下載的git工程目錄為——/ovs)
生成配置文件
# ./boot.sh(在ovs工程根目錄下)
配置
# ./configure -with-linux=/lib/modules/$(uname -r)/build
編譯
# make
# make install
# make modules_install
# config_file="/etc/depmod.d/openvswitch.conf"
# for module in datapath/linux/*.ko; do
modname="\$(basename \${module})"
echo "override \${modname%.ko} * extra" >> "\$config_file"
echo "override \${modname%.ko} * weak-updates" >> "\$config_file"
done
# depmod -a
# /sbin/modprobe openvswitch
# /sbin/lsmod | grep openvswitch
啟動
export PATH=$PATH:/usr/local/share/openvswitch/scripts
# ovs-ctl start
測試
# ovs-vsctl show
# ovs-vsctl add-br mybridge
# ovs-vsctl add-port mybridge eth0
二. Ovs的卸載
啟動ovs之後,如果改動ovs源代碼並且想更新ovs服務,進行如下操作:IIS7-VPS大全
# ovs-ctl stop 停止ovs服務
# ovs-dpctl show查看內核,會有一個ovs-system的datapath
# ovs-dpctl del-dp ovs-system 刪除上一步出現的datapath(不進行這一步,rmmod可能會報錯)
# rmmod openvswitch 卸載openvswitch內核模塊,使用lsmod | grep openvswitch 沒有openvswitch
# 進入ovs源代碼目錄,按照前述編譯步驟重新編譯安裝
linux下快速安裝和卸載open-vswitch的操作方法介紹