本文主要介绍了如何搭建一个SDN控制器opendaylight测试环境,本文主要对版本为Beryllium SR3的opendaylight基于Ubuntu14.04.5进行安装,其它版本类似。
平台:
ubuntu虚拟机:ubuntu14.04.5-server
1.安装odl依赖包
apt-get update
a)基础包
apt-get install unzip lrzsz
b)jdk
apt-get install openjdk-7-jdk
c)设置java环境变量
1).查看java安装路径
update-alternatives --config java
2).vim /etc/environment
文件最末尾增加一行:
JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
当前终端需要退出ubuntu然后重新登入,才能加载该环境变量
2.下载ODL包
从OpenDaylight官网下载:https://www.opendaylight.org/downloads

3.解压odl包
unzip distribution-karaf-0.4.3-Beryllium-SR3.zip
cd distribution-karaf-0.4.3-Beryllium-SR3
4.修改配置
进入distribution-karaf-0.4.0-Beryllium/目录, 修改etc/org.apache.karaf.management.cfg文件的以下两行内容:
rmiRegistryHost = 127.0.0.1
rmiServerHost = 127.0.0.1
注:如果不修改这个文件则执行karaf程序时会出现线程异常且No route to host错误。
5.运行ODL
./bin/karaf

6.安装功能组件
opendaylight-user@root>feature:list -i
opendaylight-user@root>feature:installodl-restconf
opendaylight-user@root>feature:installodl-l2switch-switch
opendaylight-user@root>feature:installodl-openflowplugin-all
opendaylight-user@root>feature:installodl-dlux-all
opendaylight-user@root>feature:installodl-mdsal-all

7.登陆管理WEB UI
http://192.168.128.71:8181/index.html
用户名和密码都是admin


如果登陆异常:
可以通过logout退出karaf平台,进入odl主目录,删除data目录,执行./karaf clean,再次重新执行./karaf程序和加载相应组件。