操作系统:Linux x64 / Ubuntu 14.04

研究领域:软件定义网络SDN (Software-defined Networking)

开发组件:OpenDaylight

本文原文链接:https://jiang-hao.com/articles/2018/backend-BuildandInstallOpenDaylightonUbuntu.html

一、环境搭建

1. Java+Apache Maven基本开发环境搭建。详见相应的前面两篇文档:

《Linux Ubuntu系统下Java开发环境搭建》

《Linux Ubuntu系统下Apache Maven的安装和配置》

2. 安装用来获取OpenDaylight源码的Git工具。

sudo apt-get install git-core

3. 针对Opendaylight,安装好Maven后,需要编辑一个非常重要的文件 settings.xml。直接修改该文件,就能在机器上全局地定制 Maven的行为。~/.m2是默认的maven本地仓库。刚装好maven的后~/.m2下是没有settings.xml的文件的。在/etc/maven下有settings.xml的原型,一般情况下,我们更偏向于复制该文件至home目录下的.m2/目录下(这里~表示用户目录),然后修改该文件,在用户范围定制 Maven的行为。前者又被叫做全局配置,后者被称为用户配置。如果两者都存在,它们的内容将被合并,并且用户范围的settings.xml优先。在这里要在~/目录下创建.m2文件夹,然后执行修改命令(详见官网:https://wiki.opendaylight.org/view/GettingStarted:Development_Environment_Setup):

sudo mkdir .m2
sudo cp -n ~/.m2/settings.xml{,.orig} ; \wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml

完成后输入“sudo gedit /.m2/settings.xml”查看settings.xml内容,应该显示如下:

# Shortcut command for grabbing settings.xml
cp -n ~/.m2/settings.xml{,.orig} ; \
wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <profiles>
<profile>
<id>opendaylight-release</id>
<repositories>
<repository>
<id>opendaylight-mirror</id>
<name>opendaylight-mirror</name>
<url>http://nexus.opendaylight.org/content/repositories/public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>opendaylight-mirror</id>
<name>opendaylight-mirror</name>
<url>http://nexus.opendaylight.org/content/repositories/public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile> <profile>
<id>opendaylight-snapshots</id>
<repositories>
<repository>
<id>opendaylight-snapshot</id>
<name>opendaylight-snapshot</name>
<url>http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>opendaylight-snapshot</id>
<name>opendaylight-snapshot</name>
<url>http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles> <activeProfiles>
<activeProfile>opendaylight-release</activeProfile>
<activeProfile>opendaylight-snapshots</activeProfile>
</activeProfiles>
</settings>

二、OpenDaylight源码获取、编译和安装

1. 新建项目文件夹,获取OpenDaylight源码:

sudo mkdir openDayLight
cd openDayLight
sudo git clone https://git.opendaylight.org/gerrit/p/controller.git

2. 指定编译ODL的版本(以Lithium锂版本为例)并查看确认:

cd controller
sudo git checkout stable/lithium
git branch

3. 联网编译Controller(确认之前的settings.xml文件已经修改好):

mvn clean install

* 如果编译过程中出现Test编译错误,可以加上 -DskipTests 跳过测试加快编译速度,其他编译错误和尝试解决方案:

目前遇到两种:
a. 指定目录不能创建或访问:更改文件夹读写权限,进入sudo模式重新编译
b. pom.xml相关错误:将~/.m2下的settings.xml复制到/root/.m2目录下:sudo cp ~/.m2/settings.xml /root/.m2,重新编译
编译成功!

4. 控制器验证运行。

旧版本的目录结构是“controller/opendaylight/distribution”,在新版本的目录结构中不再存在“distribution”这个子文件夹,这就是很多朋友参照以前的指南却找不到distribution子文件夹来启动控制器的原因。在这里应该cd进入“controller/karaf/opendaylight-karaf”文件夹,输入:

./target/assembly/bin/karaf

这时将启动控制器进入opendaylight-user@root>模式。这个时候,Opendaylight的controller项目初步安装就完成了!

*三、TEST:Integration项目源码的编译安装

*之前编译好的Controller项目是没有WebGUI(DLUX)等丰富Feature的核心控制器。Integration是一个框架性的工程,所有自己开发和修改的部分(包括controller、openflowPlugin&Java三个工程)编译为包后,都可以放在该工程的目录下一起执行。注意,如果是自己开发的包,则可以直接放到该目录下。但是如果是修改的原本工程,然后编译的包要替换掉上面目录中原来的包,这里有个问题是 integration 的 plugin目录下的包名和 controller, openflowplugin, openflowjava 中编译出来的包命名方式有点小差别,复制过去之前先重命名下,使之和目录下的原来包文件名一致,再复制替换。(参考自@jason-zhou童鞋的《OpenDaylight开发学习笔记基础之Controller篇》)。将各个工程的jar包copy到integration里后,运用mvn clean install 编译integration。工程所在目录:

username@ubuntu:~/developApps/openDayLight/integration/distributions/karaf/target/assembly/system/org/opendaylight$ ls
aaa integration neutron sdninterfaceapp usc
bgpcep iotdm nic sfc vpnservice
capwap l2switch odlparent snmp vtn
<strong><span style="color:#ff0000;">controller</span></strong> lacp <strong><span style="color:#ff0000;">openflowjava</span></strong> sxp yangtools
coretutorials lispflowmapping <span style="color:#ff0000;"><strong>openflowplugin</strong></span> tcpmd5
didm mdsal ovsdb topoprocessing
dlux nemo packetcable tsdr
groupbasedpolicy netconf reservation ttp

*这里仅给出基本的Integration项目的编译安装步骤,Openflowplugin和Openflowjava工程将另文详述。

1. 下载并编译Integration。

回到openDaylight根目录,输入如下命令获取Integration源码:

git clone https://git.opendaylight.org/gerrit/p/integration.git

操作完成后可以看到目录下多出了integration目录,进入integration目录,指定版本(checkout)为stable/lithium,进行编译:

cd integration
git checkout stable/lithium
mvn clean install -DskipTests (或者 cd进入子目录/distributions/karaf下执行此命令)

2.编译完成后,进入integration/distributions/karaf/target/assembly目录,运行如下命令启动ODL:

bin/karaf

此时进入ODL命令行界面,通过“feature:list -i”命令可以查看已经安装的功能模块,通过“feature:install <feature>”命令可以安装想要的feature。

* Karaf module会把控制器的Plugin制作成Karaf Feature,然后打包成可以导入到Apache karaf的kar文件。Karaf基于OSGI的运行环境,做为OSGI应用的管理容器提供各种管理utility。

到这里,一个可供开发和安装丰富Feature功能模块的OpenDaylight控制器已经基本搭建完成。

本文永久更新地址:https://jiang-hao.com/articles/2018/backend-BuildandInstallOpenDaylightonUbuntu.html

博客地址:https:/jiang-hao.com

Ubuntu系统下OpenDaylight源码编译安装的更多相关文章

  1. Linux 系统下用源码包安装软件

    Linux系统下用源码包安装软件 by:授客 QQ:1033553122 下载源码安装包,解压或者直接双击打开(如果有安装zip或rar等压缩/解压缩软件的话),查找相关的安装说明文件,一般是READ ...

  2. ubuntu下mysql源码编译安装

    建议:cpu4核以上,内存4G以上 1. 安装环境:Ubuntu Server 14.10MySQL-5.6.23.tar.gz 2. 安装必备的工具sudo apt-get install make ...

  3. Ubuntu 14.04 LTS 下使用源码编译安装 Sagemath 6.7 x64 (小结)

    原先博客放弃使用,几篇文章搬运过来 下载源码包 系统的最低要求: 6GB 硬盘 : 2GB RAM. 命令行工具: A C/C++ compiler: Since Sage builds its ow ...

  4. ubuntu 18.04 64bit下如何源码编译安装anbox

    1. 准备工作 1.1 安装gcc 7.x版本 sudo apt-get install gcc-7 -y 1.2 安装依赖的库及其工具 sudo apt install build-essentia ...

  5. Mac下使用源码编译安装TensorFlow CPU版本

    1.安装必要的软件 1.1.安装JDK 8 (1)JDK 8 can be downloaded from Oracle's JDK Page: http://www.oracle.com/techn ...

  6. centos7下比特币源码编译安装

    今天我们介绍比特币的源码安装过程,是利用编译安装的 首先安装依赖 1 yum install -y boost-devel qt-devel protobuf-devel qrencode-devel ...

  7. 001_centos7下比特币源码编译安装

    今天我们介绍比特币的源码安装过程,是利用编译安装的 首先安装依赖 yum install -y boost-devel qt-devel protobuf-devel qrencode-devel l ...

  8. 在Linux下用源码编译安装apache2

    Linux下安装一个软件,最好去看下它的官方guide,apache2.4的安装安装guide 0. installation guide http://httpd.apache.org/docs/2 ...

  9. linux下如何源码编译安装vim

    1. 获取源码 git clone https://github.com/vim/vim.git ~/vim cd ~/vim 2. 配置 ./configure --prefix=/home/jel ...

随机推荐

  1. hdu 1425

    题目 这道题用快排做总是会超时,但是别人的快排就不会超时,最后看博客说最保险的方法还是用哈希的思想[哈希思想:散列再循环,对每一个数字进行通过改变哈希表的地址散列放置,将散列地址的哈希表记为1,这样 ...

  2. express session

    一.什么是session? 最近在学习node.js 的express框架,接触到了关于session方面的内容.翻阅了一些的博客,学到了不少东西,发现一篇博文讲的很好,概念内容摘抄如下: Sessi ...

  3. 【转】Swig Getting Started

    Installation Via NPM: $ npm install swig --save Basic Usage Swig has multiple ways to compile and re ...

  4. python 实现过滤出tomcat日志中含有ERROR 或Exception 的行并保存在另一个文件

    遍历多个tomcat日志文件,找出含有ERROR 和Exception 的日志,并把该行日志输出到另一个文件中:(这里为了体现python模块导入的知识,所有建立了多个文件夹和模块) 项目结构: co ...

  5. asp.net Ibatis.net 批量插入数据ORACLE

    在开发中我们有时会遇到需要批量插入数据,最普通的就是每次 插入一条.但是当数据量大道一定的地步会很影响性能.下面例子示范了ibatis.net批量插入 ibatis.net 的XML文件里面使用ite ...

  6. wpf控件拖动

    Thumb 拖动 上代码! <Window x:Class="Thumb控件移动.MainWindow" xmlns="http://schemas.microso ...

  7. Restframework 权限permission 组件实例-2

    1.在视图类里添加权限组件 class BookView(APIView): authentication_classes = [UserAuth] permission_classes = [SVI ...

  8. window / Linux 下 Golang 开发环境的配置

    一直专注于使用python语言进行程序开发,但是却又一直被它的性能问题所困扰,直到遇到了天生支持高并发的Golang,这似乎也成了学习go语言最理所当然的理由.下面介绍下Go语言开发环境搭建的步骤: ...

  9. 在html页面添加一个隐藏域,并渲染一个需要保存的数值,在js中需要再获取,而不影响页面结构

    <div style="display:none">可以将需要保存的数值放在文本内容中,也可以放在标签的属性当中, 如果放在文本内容中,注意换行后 \n 的存在< ...

  10. Java直接内存与非直接内存性能测试

    什么是直接内存与非直接内存 根据官方文档的描述: A byte buffer is either direct or non-direct. Given a direct byte buffer, t ...