Skip to content

OF Patch Manager install

okinawaopenlabs edited this page Sep 10, 2015 · 8 revisions

##Prerequisites ####Install tomcat7

sudo apt-get install tomcat7

####Install apache2

sudo apt-get install apache2

####Install java

sudo apt-get install openjdk-7-jdk

####Download OF-Patch Manager sources

cd /tmp  
git clone https://github.com/okinawaopenlabs/of-patch-manager.git  

##Set up OrientDB Download OrientDB from http://orientdb.com/ .

Note:
You will need version 2.X.X.

####Create user for OrientDB

sudo useradd -d /opt/orientdb -M -r -s /bin/false -U orientdb

####Install OrinetDB sudo unzip orientdb-community-2.0.11.zip -d /opt
cd /opt
sudo ln -s orientdb-community-2.0.11 orientdb
sudo chown -R orientdb.orientdb orientdb*
sudo chmod 775 /opt/orientdb/bin
sudo chmod 775 /opt/orientdb/log
sudo chmod g+x /opt/orientdb/bin/*.sh

####Modify config file sudo vi /opt/orientdb/config/orientdb-server-config.xml

Add the following line in "<users>" section.

<user name="admin" password="admin" resources="*"/>  

Note:
You can use another name "admin" and password "admin".
If you changed it, you should use same parameter in "ofpm.properties".

####Modify init file sudo cp /opt/orientdb/bin/orientdb.sh /etc/init.d/
sudo sed -i "s|YOUR_ORIENTDB_INSTALLATION_PATH|/opt/orientdb|;s|USER_YOU_WANT_ORIENTDB_RUN_WITH|orientdb|" /etc/init.d/orientdb.sh sudo vi /etc/init.d/orientdb.sh

Edit as follows:

#su -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./server.sh 1>../log/orientdb.log 2>../log/orientdb.err &" - $ORIENTDB_USER  
sudo -u $ORIENTDB_USER sh -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./server.sh 1>../log/orientdb.log 2>../log/orientdb.err &"  
#su -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./shutdown.sh 1>>../log/orientdb.log 2>>../log/orientdb.err &" - $ORIENTDB_USER  
sudo -u $ORIENTDB_USER sh -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./shutdown.sh 1>>../log/orientdb.log 2>>../log/orientdb.err &"  

####Set up OrientDB

sudo /etc/init.d/orientdb.sh start  
sudo /etc/init.d/orientdb.sh status  
sudo /opt/orientdb/bin/console.sh  
orientdb> create database remote:localhost/of-patch admin admin plocal  
orientdb> disconnect  
orientdb> connect remote:<your ip address>/of-patch admin admin  

Note:
your ip address can change your ip address.

orientdb> import database /tmp/of-patch-manager/tools/ofpm_empty_orientdb.export.gz -preserveClusterIDs=true  
orientdb> info  
orientdb> disconnect  
orientdb> exit  
sudo /etc/init.d/orientdb.sh stop  
sudo /etc/init.d/orientdb.sh status  

####Modify OrientDB user sudo usermod -a -G orientdb tomcat7
sudo chmod -R g+w /opt/orientdb/databases/of-patch

##Install OF-Patch manager

cd /tmp/of-patch-manager  
mvn compile  
mvn package  
sudo mkdir /var/lib/tomcat7/webapps/ofpm  
sudo mv target/of-patch-manager.war /var/lib/tomcat7/webapps/ofpm/  
cd /var/lib/tomcat7/webapps/ofpm/  
sudo jar xvf of-patch-manager.war  

####Modify config file
If you change OrientDB configuration, please refer to following steps.

sudo vi /var/lib/tomcat7/webapps/ofpm/WEB-INF/classes/ofpm.properties

db.url=jdbc:orient:plocal:/opt/orientdb/databases/of-patch  
db.driver=com.orientechnologies.orient.jdbc.OrientJdbcDriver  
db.user=admin  
db.password=admin  

Note:
db.user and db.password are must to be same parameter in "/opt/orientdb/config/orientdb-server-config.xml".

####Make directory for ofpmlog

sudo mkdir /var/log/ofpm  
sudo chown tomcat7.tomcat7 /var/log/ofpm  

##Configure Apache and Tomcat

Create "ofpm.conf" as follows:

sudo vi /etc/apache2/sites-available/ofpm.conf

  Listen 18080  
  <VirtualHost *:18080>  
    <Location / >  
      ProxyPass ajp://localhost:18009/  
      Header set Access-Control-Allow-Origin *  
      Header set Access-Control-Allow-Headers Content-Type  
      Header set Allow GET,POST,PUT,DELETE,OPTIONS  
      Header set Access-Control-Allow-Methods GET,PUT,POST,DELETE,OPTIONS  
    </Location>  
  </VirtualHost>  

Modify "000-default.conf" as follows:

sudo vi /etc/apache2/sites-available/000-default.conf

Edit as follows:

DocumentRoot /var/www/html/ofc/ryu/ctrl

sudo service apache2 reload

####Modify apache2

sudo a2enmod headers  
sudo a2enmod proxy_ajp  
sudo a2ensite ofpm  
sudo service apache2 restart  

sudo vi /var/lib/tomcat7/conf/server.xml  

Edit as follows:

<!--  
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />  
-->  
<Connector port="18009" protocol="AJP/1.3" redirectPort="8443" />  

sudo service tomcat7 restart

####Operation check

curl -X GET -H "Content-Type:application/json" "http://localhost:18080/ofpm/device_mng/"  
grep version /var/log/ofpm/of-patch-manager.log  

Check the following message is output:

[DEBUG] DeviceBusinessImpl - OF-Patch manager version = x.x.x  

Note:
x.x.x is current OF-Patch manager version.

Clone this wiki locally