ONOS 2.2安装

本机安装教程(ubuntu)

https://wiki.onosproject.org/display/ONOS/Developer+Quick+Start

  1. 安装bazel: https://docs.bazel.build/versions/master/install-ubuntu.html

    bazel需要安装0.27.X的版本,否则onos可能会装不上,我安装的是0.27.2,其他的按照文档来就行了。

  2. 需要安装的其他依赖,执行sudo apt-get install XXX:

    git
    zip
    curl
    unzip
    python # 2.7 required by some development scripts
    python3 # Required by Bazel
    bzip2 # Needed by legacy GUI build
    
  3. 安装onos

    git clone https://gerrit.onosproject.org/onos
    cd onos
    bazel build onos
    

    onos编译安装报错解决办法

    https://blog.csdn.net/daihanglai7622/article/details/88642998?tdsourcetag=s_pctim_aiomsg

    建议采用更改npm库的方式,通过设置代理的方式可能还是会安装不上。如果更改完npm库后还是报错,可能和当前的网络环境有关,多试几次,安装的时间可能会比较久,没报错就等着。成功安装onos后,之后对onos源码进行修改,再进行编译,时间就很快了。

  4. 运行onos

    bazel run onos-local -- clean debug
    # 'clean' to delete all previous running status
    # 'debug' to enable remote debugging
    

    进入onos cli:

    tools/test/bin/onos localhost
    

    通过 ONOS CLI 激活应用程序 openflow和响应转发:

    onos> app activate org.onosproject.openflow
    onos> app activate org.onosproject.fwd
    

    打开onos web界面:

    tools/test/bin/onos-gui localhost

    (这个命令好像不起作用,还是直接访问网址吧)

    或者访问 http://localhost:8181/onos/ui

    用户名密码:onos/rocks

  5. 运行mininet,连接onos

    sudo mn --controller remote,ip=<ONOS IP address> --topo torus,3,3

    ONOS IP address替换成运行onos机器的ip地址,如果是在本机运行,则填127.0.0.1

  6. 执行onos单元测试(这一步可以跳过,执行的话,运行的时间挺长的)

    bazel query 'tests(//...)' | xargs bazel test # or use 'ot' alias
    
  7. 设置bash环境变量

    编辑~/.bash_profile,添加下面两行

    export ONOS_ROOT=~/onos
    source $ONOS_ROOT/tools/dev/bash_profile
    

    执行. ~/.bash_profile

虚拟机镜像安装教程

https://wiki.onosproject.org/display/ONOS15/Distributed+ONOS+Tutorial

原文地址:https://www.cnblogs.com/dockerchen/p/11876288.html