1. 安装项目
安装环境 centos6.x
- libnetconf-master;
- pkg-config-0.29.1;
- netpeer-master;
- OpenVswitch-2.3.1;
- of-config-master;
2. OF-CONFIG安装步骤
- cmake-3.6.3;
#./bootstrap --prefix=/usr/local/cmake
#make
#make install
在/etc/profile文件结尾添加环境变量:
export PATH=/usr/local/cmake/bin:$PATH
保存退出,执行
#source /etc/profile
使配置文件生效。
- python2.7
*【netopeer-master要求python支持2.7以上版本】
*【安装ncurses-devel, readline-devel, sqlite-devel, bzip2-devel, 加载curses模块和readline模块】
安装完成后,执行以下命令:
$sudo mv /usr/bin/python /usr/bin/python2.6.6
$sudo ln -s /usr/local/bin/python2.7 /usr/bin/python
将/usr/bin/yum文件头部的
#!/usr/bin/python
改成
#!/usr/bin/python2.6.6
- setuptools
$sudo python setup.py install
- openssl;
- openssl-devel;
2.1 libnetconf-master安装
libnetconf-master依赖以下包:
- libxml2-2.7.8
libxml2-2.7.8安装完成后,进入libxml2-2.7.8目录下的python目录,执行:
$python setup.py build
$sudo python setuo.py install
$python
>>>import libxml2;
- libxml2-devel;
- libssh-0.7.3;
$mkdir buid
$cd build
$cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ..
$make
$sudo make install
- libssh2-1.4.3;
- dbus-1.7.0;
- expat-2.1.0;
- expat-devel;
*【dbus版本不能太高,否则虚拟机关机后容易出现启动不起来】
- libxslt-1.1.29;
- libxslt-devel;
- curl-7.52.1;
- libcurl-devel;
- pyang-1.7.1;
所有依赖包正确安装完成后,执行
$./configure
$make
$sudo make install.
*【如果./configure过程中出现libtool:version missmatch错误,解决方法】
$autoreconf
*【如果autoreconf过程中出现错误,解决方法:更新libtool-2.4.2, autoconf-2.69, automake-1.13.4版本】
如果 ./configure 过程中出现如下错误:
./configure: line 13060: syntax error near unexpected token `CURL,'
./configure: line 13060: ` PKG_CHECK_MODULES(CURL, libcurl)'
直接将configure文件中13060行用#注释掉即可。
2.2 pkg-config-0.29.1安装
- glib-2.42.1;
- libffi-3.3;
- libffi-devel;
*【glib-2.42.1安装过程中,提示找不到libffi错误,在没有libffi-devel安装包的情况下,可以直接安装glib2】
安装完成后,执行
$./configure
$make
$sudo make install
2.3 openvswitch-2.3.1安装
$./configure --prefix=/ --datarootdir=/usr/share --with-linux=/lib/modules/$(uname -r)/build
$sudo ln -s /usr/src/kernels/2.6.32-5.4.el6.x86_64/ /lib/modules/2.6.32-5.4.el6.x86_64/build
$make
$sudo make install
$sudo sed 's,/usr/share/,/usr/local/share/,' rhel/etc_init.d_openvswitch > /etc/init.d/openvswitch
$sudo chkconfig --add openvswitch
$sudo chkconfig openvswitch on
openvswitch开启命令:
#/usr/share/openvswitch/scripts/ovs-ctl start
【多种编译环境下,编译过程中有时会出现:无法识别的命令行标识:“-mno-string”。则可能进入到其他环境下了,如powerpc等,则只需执行:】
#export ARCH=x86
【openvswitch.ko问题:如果出现 insmod: error inserting ‘openvswitch.ko’: -1 Unknown symbol in module】
解决方法:
#rmmod bridge
#modprobe libcrc32c
#modprobe openvswitch
2.4 netopeer安装
2.4.1 安装netopeer-server
$./configure --with-libnetconf=/usr/local/lib
$make
$sudo make install
如果出现以下错误:
configure:error:Package requirements (libnetconf) were not met:
执行以下命令:
#export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
在/etc/profile中添加环境变量
export PATH=/usr/local/bin:$PATH
开启netopeer server命令:
#/usr/local/bin/netopeer-server -d
参数-d表示netopeer-server为后台启动模式,也可以使用参数-v 0~3(errors, warnings, verbose, debug)。
2.4.2 安装netopeer-cli
$sudo ln -s /usr/local/lib/libnetconf.so.0 /lib
$./configure
$make
$sudo make install
2.4.3 安装transAPI
依赖包:
- augeas-1.4.0
安装过程中,可能出现找不到subprocess模块的错误:
利用python安装该模块过程中,出现错误提示:
No module named ‘fcntl’
在目录/usr/local/lib/python2.7/下添加fcntl.py文件,文件内容为:
def fcntl(fd, op, arg=0):
return 0
def ioctl(fd, op, arg=0, mutable_flag=True):
if mutable_flag:
return 0
else:
return ""
def flock(fd, op):
return
def lockf(fd, operation, length=0, start=0, whence=0):
return
然后执行:
#python
>>>import fcntl
>>>import subprocess
在netopeer-master/transAPI/cfgsystem目录下:
$./configure
$make
$sudo make install
- 如果安装过程中出现错误:No package ‘libxml-2.0’ found,执行:
#export PKG_CONFIG_PATH=/usr/local/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH
- 如果出现找不到ietf-inet-types.yang module的错误提示,通过链接ietf-inet-types.yang module.得到ietf-inet-types.yang文件,并将该文件放到netopeer-libnetconf-0.9.x/transAPI/cfgsystem/module目录下。
2.5 of-config安装
$./boot.sh
$./configure --with-ovs-srcdir=/root/openvswitch-2.3.1 PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ --disable-dbus
$make
$sudo make install
*【目前of-config编译只支持ovs-2.3.1版本的源码,编译后的ofc-server可能会支持配置更高版本的OVS】
*【如果出现./configure过程中出现错误,将相应文件中错误的地方注释掉即可】
of-config启动:
$ofc-server -v 3 -f
参数-f表示前台启动。
3. 源代码
autoconf-2.69
automake-1.13.4
libnetconf git源代码.
netopeer git源代码.
of-config git 源代码.