码迷,mamicode.com
首页 > 其他好文 > 详细

OpenvSwitch自动化重新编译和安装

时间:2015-12-21 12:18:59      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:

相信使用过OpenvSwitch的人都知道,OpenvSwitch因为要替换一部分linux内核,所以在修改OpenvSwitch源码的时候,每次都需要重新编译和安装,这个过程十分的机械和枯燥,所以写一个小脚本自动实现这个功能,源码见github

下面可以简单的分析下源码:

#remove the old ovs
aptitude remove openvswitch-common openvswitch-datapath-dkms openvswitch-controller openvswitch-pki openvswitch-switch -y
#install the new ovs
cd openvswitch-2.4.0
./configure --prefix=/usr --with-linux=/lib/modules/`uname -r`/build
make
make install 
make modules_install
rmmod openvswitch
depmod -a
#disable openvswitch controller
/etc/init.d/openvswitch-controller stop
update-rc.d openvswitch-controller disable

#start the new ovs
/etc/init.d/openvswitch-switch start
ovsdb-tool create /usr/local/etc/openvswitch/conf.db /usr/local/share/openvswitch/vswitch.ovsschema
ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock --remote=db:Open_vSwitch,Open_vSwitch,manager_options --pidfile --detach --log-file
ovs-vsctl --no-wait init
ovs-vswitchd --pidfile --detach

主要的过程为:

  1. 移除原来的OpenvSwitch的核以及库
  2. 安装编译新的OpenvSwitch
  3. 重新启动OpenvSwitch(包括数据库,主函数)

将这个脚本放在和OpenvSwitch同一个目录下,运行之后,就可以开始使用ovs了。如下图:

技术分享

OpenvSwitch自动化重新编译和安装

标签:

原文地址:http://www.cnblogs.com/cotyb/p/5062904.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!