参考官网:https://wiki.onosproject.org/display/ONOS/Installing+and+Running+ONOS
由于笔者习惯ssh,ubuntu默认没有开启ssh,所以首先设置了ssh服务。
root@localhost:~# ssh localhost
若提示:ssh: connect to host localhost port 22: Connection refused
则不存在 ssh服务
root@localhost:sudo apt-get install openssh-server
root@localhost:~# ps -e | grep ssh
622 ? 00:00:00 sshd
ssh服务开启,可以使用。
搭建环境要求:
- Ubuntu Server 14.04 LTS 64-bi
- 2GB or more RAM
- 2 or more processor
1.安装依赖:
官方建议首先安装maven再安装java8
1.1安装apache-karaf和apache-maven
root@localhost:~# mkdir Downloads Applications
root@localhost:~# cd Downloads
root@localhost:~/Downloads# wget http://archive.apache.org/dist/karaf/3.0.5/apache-karaf-3.0.5.tar.gz
root@localhost:~/Downloads# wget http://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
root@localhost:~/Downloads# tar -zxvf apache-karaf-3.0.5.tar.gz -C ../Applications/
root@localhost:~/Downloads# tar -zxvf apache-maven-3.3.9-bin.tar.gz -C ../Applications/
root@localhost:~# cd Downloads
root@localhost:~/Downloads# wget http://archive.apache.org/dist/karaf/3.0.5/apache-karaf-3.0.5.tar.gz
root@localhost:~/Downloads# wget http://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
root@localhost:~/Downloads# tar -zxvf apache-karaf-3.0.5.tar.gz -C ../Applications/
root@localhost:~/Downloads# tar -zxvf apache-maven-3.3.9-bin.tar.gz -C ../Applications/
root@localhost:~/Downloads#~# vim /etc/profile
export M2_HOME=/root/Applications/apache-maven-3.3.9
export PATH=$PATH:$M2_HOME/bin
root@localhost:~# source /etc/profile
1.2安装java8
root@localhost:~# sudo apt-get install software-properties-common -y
root@localhost:~# sudo add-apt-repository ppa:webupd8team/java -y
root@localhost:~# sudo apt-get update
root@localhost:~# sudo apt-get install oracle-java8-installer oracle-java8-set-default -y
root@localhost:~# env | grep JAVA_HOME
如果为空则需要在/etc/profile配置
root@localhost:~# vim /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
root@localhost:~# source /etc/profile
root@localhost:~# env | grep JAVA_HOME
JAVA_HOME=/usr/lib/jvm/java-8-oracle
JAVA_HOME=/usr/lib/jvm/java-8-oracle
root@localhost:~# mvn -version
root@localhost:~# java -version
到此onos依赖安装成功
2安装ONOS
2.1下载源码:
root@localhost:~# mkdir ONOS
root@localhost:~/ONOS# git clone https://gerrit.onosproject.org/onos
root@localhost:~/ONOS# vim /etc/profile
export ONOS_ROOT=/root/ONOS/onos
export KARAF_ROOT=/root/Applications/apache-karaf-3.0.5
export KARAF_ROOT=/root/Applications/apache-karaf-3.0.5
root@localhost:~/ONOS# source /etc/profile
root@localhost:~/ONOS# source /root/ONOS/onos/tools/dev/bash_profile
root@localhost:~/ONOS/onos# mvn clean install
编译了01:56h,我也是醉了。。。。。。。
3运行ONOS
3.1初始化配置
必须首先配置Karaf去加载ONOS相关的模块。Karaf的配置文件为$KARAF_ROOT/etc/org.apache.karaf.features.cfg,编辑它,追加如下的内容到featuresRepositories:
mvn:org.onosproject/onos-features/1.7.0-SNAPSHOT/xml/features
(其中版本,例如1.7.0-SNAPSHOT可以在pom.xml查看)
追加如下的内容到featuresBoot:
webconsole,onos-api,onos-core,onos-incubator,onos-gui,onos-cli,onos-rest
root@localhost:~/ONOS/onos# ok clean
3.1初始化配置
必须首先配置Karaf去加载ONOS相关的模块。Karaf的配置文件为$KARAF_ROOT/etc/org.apache.karaf.features.cfg,编辑它,追加如下的内容到featuresRepositories:
mvn:org.onosproject/onos-features/1.7.0-SNAPSHOT/xml/features
(其中版本,例如1.7.0-SNAPSHOT可以在pom.xml查看)
追加如下的内容到featuresBoot:
webconsole,onos-api,onos-core,onos-incubator,onos-gui,onos-cli,onos-rest
root@localhost:~/ONOS/onos# ok clean