1. 程式人生 > >Ubuntu16中編譯OpenDaylight

Ubuntu16中編譯OpenDaylight

OpenDaylight有三個基礎模組,分別是controllera、openflowjava和openflowplugin,需要按順序分別編譯。(注意編譯時需要聯網)

1。準備基礎環境:

安裝JDK1.8.0和Maven3.6.0。

[email protected]:~$ sudo apt-get install openjdk-8-jdk

修改環境配置:

[email protected]:~$ sudo vim /etc/environment

在最後面加一行:JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"

重啟ubuntu。

Maven安裝見:

https://www.cnblogs.com/zjd1396/p/9978652.html

安裝完後需要更新一個配置檔案:

下載檔案:https://github.com/opendaylight/odlparent/blob/master/settings.xml

將檔案中的內容複製到:~/.m2/settings.xml

2。下載三個模組的原始碼:

[email protected]_ubuntu:~# mkdir /home/myCarbon

[email protected]_ubuntu:/home/myCarbon# git clone https://git.opendaylight.org/gerrit/p/controller.git

[email protected]_ubuntu:/home/myCarbon# git clone https://git.opendaylight.org/gerrit/p/openflowjava.git

[email protected]_ubuntu:/home/myCarbon# git clone https://git.opendaylight.org/gerrit/p/openflowplugin.git

[email protected]_ubuntu:/home/myCarbon# ll
total 20
drwxr-xr-x 5 root root 4096 Nov 18 00:15 ./
drwxr-xr-x 9 root root 4096 Nov 17 07:08 ../
drwxr-xr-x 9 root root 4096 Nov 17 08:08 controller/
drwxr-xr-x 15 root root 4096 Nov 18 00:32 openflowjava/
drwxr-xr-x 25 root root 4096 Nov 18 00:53 openflowplugin/

[email protected]_ubuntu:/home/myCarbon#

然後分別進三個資料夾,分別都通過git branch -a看有哪些分支,然後都切換到carbon分支:

[email protected]_ubuntu:/home/myCarbon/openflowjava# git checkout -b remotes/origin/stable/carbon

3。編譯controller

進如下目錄執行如下編譯命令:

[email protected]_ubuntu:/home/myCarbon/controller/karaf# mvn clean install -DskipTests

最後:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 37:12 min
[INFO] Finished at: 2018-11-18T02:18:33-08:00
[INFO] ------------------------------------------------------------------------

現在可以進如下目錄執行如下命令啟動controller:

[email protected]_ubuntu:/home/myCarbon/controller/karaf/target/assembly/bin# ./karaf
Apache Karaf starting up. Press Enter to open the shell now...

100% [========================================================================]

Karaf started in 49s. Bundle stats: 15 active, 15 total

________ ________ .__ .__ .__ __
\_____ \ ______ ____ ____ \______ \ _____ ___.__.| | |__| ____ | |___/ |_
/ | \\____ \_/ __ \ / \ | | \\__ \< | || | | |/ ___\| | \ __\
/ | \ |_> > ___/| | \| ` \/ __ \\___ || |_| / /_/ > Y \ |
\_______ / __/ \___ >___| /_______ (____ / ____||____/__\___ /|___| /__|
\/|__| \/ \/ \/ \/\/ /_____/ \/


Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown OpenDaylight.

[email protected]>

4。編譯openflowjava