需先行下載的軟件:
- JVM 1.7 或者更高的版本, 例如:OpenJDK 1.7
- Git, 用於從Git repository提取ODL(OpenDaylight)控制器
- Maven
安裝相關軟件,並使用Git提取代碼:
$ sudo apt-get update $ sudo apt-get install maven git openjdk-7-jre openjdk-7-jdk $ git clone http://git.opendaylight.org/gerrit/p/controller.git $ cd controller/opendaylight/distribution/opendaylight/ $ mvn clean install $ cd target/distribution.opendaylight-0.1.0-SNAPSHOT-osgipackage/opendaylight $ ./run.sh
以為按照上面步驟就能順利安裝,那么你就錯了,總會有些bug。
下面寫寫我所遇到的bug。
1. 下載了controller的git repository之后,發現controller/opendaylight/目錄下並沒有distribution文件夾
也就是需要在controller/目錄下執行一遍mvn clean install(其實我對maven軟件部署一點都不知道,感覺就像是Makefile那樣的)。
然后就會下載一系列的文件,過程有點久,結果遇到類似下面的問題(忘記截圖了):
參考OpenDaylight Controller:Pulling, Hacking, and Pushing the Code from the CLI,執行
git checkout stable/hydrogen
然后再mvn clean install一遍就出現下面的情況:
可以看到是BUILD FAILURE,很多找不到依賴的問題,先不管,打開controller/opendaylight/目錄,發現有distribution了,以為可以繼續最上面的過程,要成功了,但又出現一些問題,執行下面命令,得到結果
$ cd controller/opendaylight/distribution/opendaylight/
$ mvn clean install
不知道怎么弄了,distribution下沒有target目錄,肯定沒成功。
於是又找到一篇文章OpenDaylight開發學習筆記基礎之Controller篇照着瞎折騰,
在controller/目錄和controller/opendaylight/distribution/opendaylight/目錄都mvn clean install一遍,想着不成功就不弄了,每次install都要幾分鍾,最后居然讓我看到了BUILD SUCCESS,警告什么的都不管了:
然后執行如下命令:
$ cd target/distribution.opendaylight-0.1.0-SNAPSHOT-osgipackage/opendaylight
$ ./run.sh
在瀏覽器輸入localhost:8080,總算是成功了。

參考資料:
1. OpenDaylight Controller:Pulling, Hacking, and Pushing the Code from the CLI
2. OpenDaylight開發學習筆記基礎之Controller篇