您的位置:首页 > 其它

ONOS安装及编译步骤(附编译出现问题的几种解决方法)

2017-12-22 21:35 776 查看

一、onos安装

下载OXP源码 并切换到最新版本

$ git clone https://github.com/paradisecr/ONOS-ICOA.git $ mv ONOS-ICOA onos
$ git checkout v2


安装onos依赖。

方法一:使用onos自带脚本安装,比较便利

$ cd onos
$ ./tools/dev/bin/onos-setup-ubuntu-devenv


方法二:手动安装,比较麻烦,需要一步步执行命令

$ mkdir Downloads Applications
$ cd Downloads
$ wget http://archive.apache.org/dist/karaf/3.0.5/apache-karaf-3.0.5.tar.gz $ wget http://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz $ tar -zxf apache-karaf-3.0.5.tar.gz -C ../Applications/
$ tar -zxf apache-maven-3.3.9-bin.tar.gz -C ../Applications/
如图所示




添加onos环境变量。

打开配置文件
$ vim ~/.profile
在末尾追加这句命令
$ source ~/onos/tools/dev/bash_profile
退出,在shell下执行source命令使其生效
$ source ~/.profile


如图所示



二、编译ONOS

为了使编译顺利,推荐使用国内Maven的镜像。

$ cd ~/Applications/apache-maven-3.3.9/conf
$ vim setting.xml




在文件里配置mirrors的子节点,添加如下mirror,覆盖之前的mirror:

<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>


如果编译依赖下载依然出错,可以采取添加profiles的子节点的方式,不覆盖之前的mirror的基础上添加其他的mirror

<profile>
<id>dev</id>
<repositories>
<repository>
<id>nexus</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>

4000
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>

<activeProfiles>
<activeProfile>dev</activeProfile>
</activeProfiles>


防止Java与Maven不一致的情况,执行以下命令:

打开配置文件
$ vim /etc/profile
在末尾添加
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
退出文件,然后执行
$ source /etc/profile


编译

$ cd ~/onos
$ mvn clean install -DskipTests




如果由于某种原因编译出现问题,可以将编译成功的虚拟机上的maven库打包到这个虚拟机上

$ tar -zcvf maven.tar.gz ./.m2
然后发送到目标主机
$ scp maven.tar.gz openlab@192.168.1.8:~/




在目标主机解压
$ tar -zxvf maven.tar.gz
然后重新编译


5. 启动控制器

$ ok clean


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: