Building ONOS 2.2.0

ONOS 2.2 use different method and package to build. This tutorial use Ubuntu 18.04.

  • Ubuntu 18.04
  • Java 11
  • Bazel

Install Java

apt install git zip curl unzip python-minimal openjdk-11-jdk -y

Install Bazel

echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
apt-get update && apt-get install bazel -y
apt-get install --only-upgrade bazel

Create User sdn

adduser sdn
passwd -d sdn
cat <<EOF >> /etc/sudoers
sdn ALL=(ALL) NOPASSWD:ALL
EOF

su sdn
cd ~

Build ONOS

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

Copy build package into /opt and change into user root

sudo cp bazel-bin/onos.tar.gz /opt/onos.tar.gz
exit

Extract

cd /opt
sudo tar xzf onos.tar.gz
mv onos-2.2.0-SNAPSHOT onos
sudo chown -R sdn:sdn onos

Create initial package running

sudo -u sdn nano /opt/onos/options
...
# running onos with user sdn
export ONOS_USER=sdn
 
# default active drivers and openflow
export ONOS_APPS=drivers,openflow-base,k8s-networking
...

Start ONOS

sudo cp /opt/onos/init/onos.initd /etc/init.d/onos
sudo cp /opt/onos/init/onos.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable onos
sudo systemctl start onos

Comments are closed.