需先行下載下傳的軟體:
- 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篇