从零开始学OpenDayLight之基础环境
Posted 水共禾刀
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从零开始学OpenDayLight之基础环境相关的知识,希望对你有一定的参考价值。
Just do it ! Code is King!
一、基础环境
0. VMware-workstation + Ubuntu-16.04;
1.JDK配置:
下载链接: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
参考链接:http://www.csdn.net/dgeek/article/details/52689235
但仍然遇到了如下问题(解决方法参考http://www.aboutyun.com/thread-6767-1-1.html):
The program ‘java‘ can be found in the following packages: * gcj-4.4-jre-headless * gcj-4.6-jre-headless * openjdk-6-jre-headless * gcj-4.5-jre-headless * openjdk-7-jre-headless
直接在命令行输入如下命令:
export PATH=$PATH:/home/Java/jdk1.8.0_141/bin
export CLASSPATH=.:/home/Java/jdk1.8.0_141/jre/bin
再使用java -version可以看到配置成功:
[email protected]:/etc/profile.d$ java -version java version "1.8.0_141" Java(TM) SE Runtime Environment (build 1.8.0_141-b15) Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)
由于重启后,命令配置将消失,所以新增java.sh(放到下面目录,系统启动会自动识别)
cd /etc/profile.d sudo vi java.sh
添加:
export PATH=$PATH:/home/Java/jdk1.8.0_141/bin export CLASSPATH=.:/home/Java/jdk1.8.0_141/jre/bin
成功后查看
[email protected]:/etc/profile.d$ cat java.sh export PATH=$PATH:/home/Java/jdk1.8.0_141/bin export CLASSPATH=.:/home/Java/jdk1.8.0_141/jre/bin
[email protected]:/etc/profile.d$ java -version java version "1.8.0_141" Java(TM) SE Runtime Environment (build 1.8.0_141-b15) Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode) [email protected]:/etc/profile.d$ cat java.sh export PATH=$PATH:/home/Java/jdk1.8.0_141/bin export CLASSPATH=.:/home/Java/jdk1.8.0_141/jre/bin
2. Maven安装:
参考链接:http://www.linuxidc.com/Linux/2017-02/140097.htm
切换到root用户:
[email protected]:/etc/profile.d$ sudo -i [sudo] password for zhl: [email protected]:~#
退出root用户,使用exit即可;
操作过程记录如下:
[email protected]:~/Downloads$ cp apache-maven-3.5.0-bin.tar.gz ./../temp cp: cannot create regular file ‘./../temp/apache-maven-3.5.0-bin.tar.gz‘: Permission denied [email protected]:~/Downloads$ sudo cp apache-maven-3.5.0-bin.tar.gz ./../temp [email protected]:~/Downloads$ sudo -i [email protected]:~# pwd /root [email protected]:~# tar zxvf /home/zhl/temp/apache-maven-3.5.0-bin.tar.gz apache-maven-3.5.0/README.txt apache-maven-3.5.0/LICENSE apache-maven-3.5.0/NOTICE apache-maven-3.5.0/lib/
[email protected]:/opt# cd /home/zhl/temp [email protected]:/home/zhl/temp# ll total 8344 drwxr-xr-x 2 root root 4096 Jul 26 00:16 ./ drwxr-xr-x 19 zhl zhl 4096 Jul 26 00:15 ../ -rw-r--r-- 1 root root 8534562 Jul 26 00:16 apache-maven-3.5.0-bin.tar.gz [email protected]:/home/zhl/temp# cd [email protected]:~# cd /opt [email protected]:/opt# mv /root/apache-maven-3.5.0/ mv: missing destination file operand after ‘/root/apache-maven-3.5.0/‘ Try ‘mv --help‘ for more information. [email protected]:/opt# mv /root/apache-maven-3.5.0/ . [email protected]:/opt# ll total 12 drwxr-xr-x 3 root root 4096 Jul 26 00:22 ./ drwxr-xr-x 24 root root 4096 Jul 25 20:28 ../ drwxr-xr-x 6 root root 4096 Jul 26 00:17 apache-maven-3.5.0/ [email protected]:/opt# cd /bin [email protected]:/bin# ln -s /opt/apache-maven-3.5.0/bin/mvn mvn [email protected]:/bin# cd /opt [email protected]:/opt# gedit /etc/profile (gedit:5490): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files [email protected]:/opt# source /etc/profile [email protected]:/opt# mvn -v Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T12:39:06-07:00) Maven home: /opt/apache-maven-3.5.0 Java version: 1.8.0_141, vendor: Oracle Corporation Java home: /home/Java/jdk1.8.0_141/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.4.0-21-generic", arch: "amd64", family: "unix"
二、OpenDaylight controller源码编译
1. controller下载链接:https://github.com/opendaylight/controller/tree/stable/carbon
2. 配套的setting.xml下载链接:https://github.com/opendaylight/odlparent/blob/stable/carbon/settings.xml
3. 执行 mvn clean install -Dmaven.test.failure.ignore=true;
[INFO] Installing /home/zhl/code/controller/controller-stable-carbon/pom.xml to /home/zhl/.m2/repository/org/opendaylight/controller/releasepom/0.5.2-SNAPSHOT/releasepom-0.5.2-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] mdsal-artifacts .................................... SUCCESS [ 1.026 s] [INFO] config-api ......................................... SUCCESS [ 47.387 s] [INFO] config-subsystem ................................... SUCCESS [ 1.623 s] [INFO] config-plugin-parent ............................... SUCCESS [ 1.636 s] [INFO] yang-jmx-generator ................................. SUCCESS [ 20.992 s] [INFO] yang-jmx-generator-plugin .......................... SUCCESS [ 24.874 s] [INFO] sal-common-api ..................................... SUCCESS [ 24.677 s] [INFO] sal-common-util .................................... SUCCESS [ 5.327 s] [INFO] sal-common-impl .................................... SUCCESS [ 7.426 s] [INFO] sal-test-model ..................................... SUCCESS [ 17.130 s] [INFO] sal-core-api ....................................... SUCCESS [ 17.604 s] [INFO] sal-core-spi ....................................... SUCCESS [ 11.724 s] [INFO] sal-binding-api .................................... SUCCESS [ 11.374 s] [INFO] sal-dom-config ..................................... SUCCESS [ 24.495 s] [INFO] sal-inmemory-datastore ............................. SUCCESS [ 23.517 s] [INFO] sal-broker-impl .................................... SUCCESS [ 33.522 s] [INFO] sal-schema-service ................................. SUCCESS [ 4.122 s] [INFO] sal-binding-util ................................... SUCCESS [ 3.590 s] [INFO] sal-binding-broker-impl ............................ SUCCESS [ 37.996 s] [INFO] sal-binding-config ................................. SUCCESS [ 16.008 s] [INFO] config-parent ...................................... SUCCESS [ 1.297 s] [INFO] sal-dom-broker-config .............................. SUCCESS [ 8.868 s] [INFO] md-sal-config ...................................... SUCCESS [ 58.410 s] [INFO] sample-toaster ..................................... SUCCESS [ 5.353 s] [INFO] sample-toaster-consumer ............................ SUCCESS [ 4.290 s] [INFO] sample-toaster-provider ............................ SUCCESS [ 14.800 s] [INFO] sal-parent ......................................... SUCCESS [ 0.032 s] [INFO] sal-samples ........................................ SUCCESS [ 0.021 s] [INFO] clustering-it ...................................... SUCCESS [ 0.019 s] [INFO] clustering-it-config ............................... SUCCESS [ 0.158 s] [INFO] clustering-it-model ................................ SUCCESS [ 14.184 s] [INFO] sal-clustering-commons ............................. SUCCESS [03:32 min] [INFO] sal-akka-raft ...................................... SUCCESS [02:27 min] [INFO] cds-access-api ..................................... SUCCESS [ 36.652 s] [INFO] cds-access-client .................................. SUCCESS [ 43.988 s] [INFO] cds-dom-api ........................................ SUCCESS [ 10.170 s] [INFO] sal-akka-raft-example .............................. SUCCESS [ 6.198 s] [INFO] sal-distributed-datastore .......................... SUCCESS [18:26 min] [INFO] clustering-it-provider ............................. SUCCESS [ 8.670 s] [INFO] config-util ........................................ SUCCESS [ 9.823 s] [INFO] config-manager-facade-xml .......................... SUCCESS [ 10.873 s] [INFO] blueprint .......................................... SUCCESS [ 39.547 s] [INFO] netty-config-api ................................... SUCCESS [ 25.094 s] [INFO] shutdown-api ....................................... SUCCESS [ 3.983 s] [INFO] config-manager ..................................... SUCCESS [ 21.123 s] [INFO] shutdown-impl ...................................... SUCCESS [ 21.479 s] [INFO] features-config .................................... SUCCESS [08:55 min] [INFO] config-persister-api ............................... SUCCESS [ 5.156 s] [INFO] config-persister-file-xml-adapter .................. SUCCESS [ 34.080 s] [INFO] config-persister-directory-xml-adapter ............. SUCCESS [ 6.199 s] [INFO] config-persister-impl .............................. SUCCESS [ 8.930 s] [INFO] config-persister-feature-adapter ................... SUCCESS [ 4.236 s] [INFO] features-config-persister .......................... SUCCESS [01:52 min] [INFO] netty-event-executor-config ........................ SUCCESS [ 10.106 s] [INFO] netty-threadgroup-config ........................... SUCCESS [ 8.068 s] [INFO] threadpool-config-api .............................. SUCCESS [ 3.605 s] [INFO] threadpool-config-impl ............................. SUCCESS [ 13.322 s] [INFO] netty-timer-config ................................. SUCCESS [ 8.092 s] [INFO] config-netty-config ................................ SUCCESS [ 1.593 s] [INFO] features-config-netty .............................. SUCCESS [ 43.829 s] [INFO] sal-dom-xsql ....................................... SUCCESS [ 11.506 s] [INFO] Apache Karaf :: Shell odl/xsql Commands ............ SUCCESS [ 3.207 s] [INFO] sal-connector-api .................................. SUCCESS [ 4.956 s] [INFO] sal-dom-xsql-config ................................ SUCCESS [ 0.336 s] [INFO] sal-clustering-config .............................. SUCCESS [ 0.353 s] [INFO] sal-cluster-admin-api .............................. SUCCESS [ 6.509 s] [INFO] sal-cluster-admin-impl ............................. SUCCESS [02:56 min] [INFO] model-parent ....................................... SUCCESS [ 1.193 s] [INFO] model-inventory .................................... SUCCESS [ 6.717 s] [INFO] messagebus-api ..................................... SUCCESS [ 10.494 s] [INFO] messagebus-util .................................... SUCCESS [01:08 min] [INFO] messagebus-spi ..................................... SUCCESS [ 5.229 s] [INFO] messagebus-impl .................................... SUCCESS [ 12.471 s] [INFO] messagebus-config .................................. SUCCESS [ 0.166 s] [INFO] sal-remoterpc-connector ............................ SUCCESS [ 54.328 s] [INFO] features-mdsal ..................................... SUCCESS [09:08 min] [INFO] config-it-base ..................................... SUCCESS [ 20.035 s] [INFO] mdsal-it-base ...................................... SUCCESS [ 3.408 s] [INFO] mdsal-it-parent .................................... SUCCESS [ 4.328 s] [INFO] sample-toaster-it .................................. SUCCESS [01:13 min] [INFO] sal-dummy-distributed-datastore .................... SUCCESS [01:19 min] [INFO] Apache Karaf :: Shell odl/xsql Commands ............ SUCCESS [ 3.235 s] [INFO] sal-binding-it ..................................... SUCCESS [03:22 min] [INFO] sal-binding-dom-it ................................. SUCCESS [ 24.840 s] [INFO] mdsal-trace-api .................................... SUCCESS [ 5.017 s] [INFO] mdsal-trace-dom-impl ............................... SUCCESS [ 4.111 s] [INFO] mdsal-trace-binding-impl ........................... SUCCESS [ 1.179 s] [INFO] mdsal-trace-features ............................... SUCCESS [ 58.111 s] [INFO] odl-config-api ..................................... SUCCESS [03:04 min] [INFO] OpenDaylight :: Config :: All ...................... SUCCESS [ 36.601 s] [INFO] odl-config-core .................................... SUCCESS [ 45.630 s] [INFO] odl-config-manager ................................. SUCCESS [ 33.703 s] [INFO] config-persister-feature4-adapter .................. SUCCESS [ 4.383 s] [INFO] OpenDaylight :: Config Persister ................... SUCCESS [ 36.441 s] [INFO] OpenDaylight :: Config Persister:: Config Startup .. SUCCESS [ 35.118 s] [INFO] odl-config-netty-config-api ........................ SUCCESS [ 33.180 s] [INFO] OpenDaylight :: Config-Netty ....................... SUCCESS [ 37.587 s] [INFO] OpenDaylight :: MDSAL :: Broker .................... SUCCESS [01:00 min] [INFO] odl-mdsal-clustering-commons ....................... SUCCESS [ 56.875 s] [INFO] odl-mdsal-remoterpc-connector ...................... SUCCESS [ 44.190 s] [INFO] odl-mdsal-distributed-datastore .................... SUCCESS [ 45.558 s] [INFO] odl-mdsal-broker ................................... SUCCESS [ 56.576 s] [INFO] OpenDaylight :: TracingBroker ...................... SUCCESS [ 58.356 s] [INFO] OpenDaylight :: TracingBroker ...................... SUCCESS [01:07 min] [INFO] mdsal-trace-feature-aggregator ..................... SUCCESS [ 0.065 s] [INFO] mdsaltrace ......................................... SUCCESS [ 0.020 s] [INFO] yang-test-plugin ................................... SUCCESS [ 43.954 s] [INFO] yang-test .......................................... SUCCESS [ 20.250 s] [INFO] logback-config ..................................... SUCCESS [ 40.587 s] [INFO] config-artifacts ................................... SUCCESS [ 8.597 s] [INFO] config-filtering-parent ............................ SUCCESS [ 0.764 s] [INFO] model-topology ..................................... SUCCESS [ 5.427 s] [INFO] protocol-framework ................................. SUCCESS [01:20 min] [INFO] commons.logback_settings ........................... SUCCESS [ 1.911 s] [INFO] filter-valve ....................................... SUCCESS [ 13.103 s] [INFO] liblldp ............................................ SUCCESS [ 14.803 s] [INFO] benchmark-api ...................................... SUCCESS [ 7.957 s] [INFO] dsbenchmark ........................................ SUCCESS [ 7.287 s] [INFO] ntfbenchmark ....................................... SUCCESS [ 5.727 s] [INFO] rpcbenchmark ....................................... SUCCESS [ 5.724 s] [INFO] benchmark-artifacts ................................ SUCCESS [ 0.024 s] [INFO] benchmark-aggregator ............................... SUCCESS [ 0.026 s] [INFO] odl-jolokia-osgi ................................... SUCCESS [ 1.618 s] [INFO] karaf-parent ....................................... SUCCESS [ 50.587 s] [INFO] features-extras .................................... SUCCESS [01:22 min] [INFO] distribution.opendaylight-karaf .................... SUCCESS [05:22 min] [INFO] opendaylight-karaf-empty ........................... SUCCESS [ 24.427 s] [INFO] karaf-aggregator ................................... SUCCESS [ 0.080 s] [INFO] odl-config-all ..................................... SUCCESS [ 39.769 s] [INFO] features4-config ................................... SUCCESS [ 43.597 s] [INFO] features-config-aggregator ......................... SUCCESS [ 0.035 s] [INFO] Opendaylight :: Config Persister:: Mapping for Config Subsystem SUCCESS [ 31.774 s] [INFO] OpenDaylight :: Config Persister:: All ............. SUCCESS [ 38.429 s] [INFO] features4-config-persister ......................... SUCCESS [ 40.072 s] [INFO] features-config-persister-aggregator ............... SUCCESS [ 0.029 s] [INFO] features4-config-netty ............................. SUCCESS [ 36.761 s] [INFO] features-config-netty-aggregator ................... SUCCESS [ 0.033 s] [INFO] odl-clustering-test-app ............................ SUCCESS [01:00 min] [INFO] odl-mdsal-xsql ..................................... SUCCESS [01:01 min] [INFO] OpenDaylight :: Toaster ............................ SUCCESS [ 57.820 s] [INFO] odl-mdsal-all ...................................... SUCCESS [01:03 min] [INFO] odl-mdsal-clustering ............................... SUCCESS [01:10 min] [INFO] odl-message-bus-collector .......................... SUCCESS [01:07 min] [INFO] features4-mdsal .................................... SUCCESS [01:12 min] [INFO] features-mdsal-aggregator .......................... SUCCESS [ 0.054 s] [INFO] features-protocol-framework ........................ SUCCESS [ 40.792 s] [INFO] OpenDaylight :: Protocol Framework ................. SUCCESS [ 36.886 s] [INFO] features4-protocol-framework ....................... SUCCESS [ 36.158 s] [INFO] features-protocol-framework-aggregator ............. SUCCESS [ 0.026 s] [INFO] Jolokia JMX/HTTP bridge ............................ SUCCESS [ 40.450 s] [INFO] OpenDaylight :: Extras :: All ...................... SUCCESS [ 44.130 s] [INFO] features4-extras ................................... SUCCESS [ 37.831 s] [INFO] features-extras-aggregator ......................... SUCCESS [ 0.045 s] [INFO] features-mdsal-benchmark ........................... SUCCESS [02:57 min] [INFO] OpenDaylight :: Benchmark :: API ................... SUCCESS [ 33.490 s] [INFO] OpenDaylight :: dsbenchmark ........................ SUCCESS [ 55.640 s] [INFO] OpenDaylight :: MD-SAL :: benchmark ................ SUCCESS [ 55.503 s] [INFO] OpenDaylight :: ntfbenchmark ....................... SUCCESS [ 55.919 s] [INFO] features4-mdsal-benchmark .......................... SUCCESS [ 54.460 s] [INFO] features-mdsal-benchmark-aggregator ................ SUCCESS [ 0.040 s] [INFO] features-controller ................................ SUCCESS [ 0.019 s] [INFO] archetypes-parent .................................. SUCCESS [ 5.008 s] [INFO] opendaylight-startup-archetype ..................... SUCCESS [ 27.983 s] [INFO] controller ......................................... SUCCESS [ 0.015 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:01 h
以上是关于从零开始学OpenDayLight之基础环境的主要内容,如果未能解决你的问题,请参考以下文章