Build and Install OpenDaylight on Ubuntu



Operating System:Linux x64 / Ubuntu 14.04
Prerequisites:Linux system with Java and Maven installed
Chinese version is also available at Ubuntu系统下OpenDaylight源码编译安装


STEP 1, Environment Tuning


1. Install Git tool by command line:

sudo apt-get install git-core

2. After the installation of Java and Maven, you need to edit a very important file for OpenDaylight which is named "settings.xml". It can customize the behavior of Maven at system level. But we often choose to make it in ~/.m2 folder under your home directory to limit it in user scope:
(under ~/ directory)

mkdir .m2                     
cp -n ~/.m2/settings.xml{,.orig} ; \wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml

You can also use this command instead:

curl https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml --create-dirs -o ~/.m2/settings.xml

3. A new settings.xml file should now appear in the folder you just created, go and check the content, which should be something similar as below:

# gedit ~/.m2/settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <profiles>
    <profile>
      <id>opendaylight-release</id>
      <repositories>
        <repository>
          <id>opendaylight-mirror</id>
          <name>opendaylight-mirror</name>
          <url>http://nexus.opendaylight.org/content/repositories/public/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>opendaylight-mirror</id>
          <name>opendaylight-mirror</name>
          <url>http://nexus.opendaylight.org/content/repositories/public/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>

    <profile>
      <id>opendaylight-snapshots</id>
      <repositories>
        <repository>
          <id>opendaylight-snapshot</id>
          <name>opendaylight-snapshot</name>
          <url>http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>opendaylight-snapshot</id>
          <name>opendaylight-snapshot</name>
          <url>http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>

  <activeProfiles>
    <activeProfile>opendaylight-release</activeProfile>
    <activeProfile>opendaylight-snapshots</activeProfile>
  </activeProfiles>
</settings>  


STEP 2, Build and Install OpenDaylight Controller Project

Please keep in mind that here controller really means core controller without many other additional features, such as WebUI(dlux). As for the development of other features in OpenDaylight and if you need dlux, please refer to next STEP.


1.Create a directory for your project and get the source code of OpenDaylight controller:

mkdir openDayLight
cd openDayLight
git clone https://git.opendaylight.org/gerrit/p/controller.git

2.Specify the version of OpenDaylight you want to build and check:

cd controller
git checkout stable/lithium    //here I specify stable/lithium version
git branch

3.Make sure your settings.xml file is right in place. Build the code with Internet connecdtion:

mvn clean install -DskipTests

4.Now run your controller:

cd controller/karaf/opendaylight-karaf/target/assembly    
./bin/karaf

5.And after a while you will enter the OpenDaylight command line mode as shown below:

opendaylight-user@root>

6.Some useful command lines to check and install features:

feature:list -i   //show the features which are already installed
feature:list      //show all available features (installed ones are marked with "x")
feature:list | grep <keyword>   //show features that contains <keyword>
feature:install <feature>   //install a <feature>


STEP 3, Build and Install OpenDaylight Integration Project


Integration Project is more like a framework project which is to integrate all other projects into OpenDaylight. With Integration project you can modify or put your own features under this project directory and test with the controller.

1.Download the Integration source code:

git clone https://git.opendaylight.org/gerrit/p/integration.git

2.Get into the integration directory and specify the version you want:

cd integration
git checkout stable/lithium
mvn clean install -DskipTests

3.After previous step is done, you may would like to run the controller:

cd integration/distributions/karaf/target/assembly
./bin/karaf

4.Finally you can now begin your development and replace original features with your own ones under this directory, after which you would be able to build and run the controller for testing:

username@ubuntu:~/developApps/openDayLight/integration/distributions/karaf/target/assembly/system/org/opendaylight$ ls
aaa               integration      neutron         sdninterfaceapp  usc
bgpcep            iotdm            nic             sfc              vpnservice
capwap            l2switch         odlparent       snmp             vtn
controller        lacp             sxp             yangtools
coretutorials     lispflow         mapping         tcpmd5
didm              mdsal            ovsdb           topoprocessing
dlux              nemo             packetcable     tsdr
groupbasedpolicy  netconf          reservation     ttp

(END)


photo-zzz.png

Hao JiangJustin Time

We only live once, and time just goes by.

  • R&D Engineer @H3C
  • Hangzhou, China

  • Facebook
    微博
    Linkedin
    Github
    Email
    Instagram
    ResearchGate
    知乎
    OSChina