Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update installation instructions based on experience

...

  1. JDK 1.6 or above (1.7 is recommended)

  2. Development Editor

  3. CouchDB - port :5984.  (Remember to put properties file, bean id and configure in appcontext of spring); /start couchDB

  4. PostgresSQL 9.1 or above (Install as a service since its only used for reporting) - Port: 5432; /start postgres windows service

  5. ActiveMQ 5.4.2 (To stop Exception of JMS for ActiveMQ appearing in console, change in activemq.prop.. tcp:// to vm:// since both are on same server); /start ActiveMQ

  6. Mysql 5.6 or above (This is required by the Quartz plugin and opensrp-web)
  7. Maven 2 or above
  8. Apache-Tomcat 6 or above / Jetty

  9. OpenMRS


Here is the details explanation of OpenSRP installation process for linux machine. 
  1. You will need to Install jdk1.7 to run the application. To do so, first install OpenJDK or Java JDK (both can be used to build OpenSRP however OpenJDK is recommended). 

    1. To install OpenJDK run the following command from terminal: 

    sudo apt-get install openjdk-7-jdk

    After install Java, set JAVA_HOME variable - you will need this later in the set up so be sure to set it correctly. First find out the path of your Java Installation

    sudo update-alternatives --config java

       It should return something like this:

     


    There are 2 choices for the alternative java (providing /usr/bin/java).
    
    Selection    Path                                            Priority   Status
    ------------------------------------------------------------
    * 0            /usr/lib/jvm/java-7-oracle/jre/bin/java          1062      auto mode
      1            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode
      2            /usr/lib/jvm/java-7-oracle/jre/bin/java          1062      manual mode
    
    Press enter to keep the current choice[*], or type selection number:

          b. Copy your installed Java path and put it into file /etc/environmet

    sudo nano /etc/environment

    c. Add the following line at the end of the file (Replace YOUR_PATH with your Java path above) 

           JAVA_HOME = "YOUR PATH"

           d. Reload this file :

           source /etc/environment

           e. Test it by executing

              echo $JAVA_HOME

         If you have set it correctly, your path should now show on screen (ie. user_name:/opt/activemq/bin$echo$JAVA_HOME/usr/lib/jvm/java-1.7.0-openjdk-i386)

  2. For development environment install preferred Java editor Eclipse, STS, NetBeans IDE, IntelliJ IDEA etc. STS and IntelliJ IDEA is preferable.

    You can download STS (Spring Tools Suite) here
    You can download IntelliJ IDEA here

    Clone OpenSRP Server git repository from https://github.com/OpenSRP/opensrp-server using git clone https://github.com/OpenSRP/opensrp-server.git

    If on eclipse, you can either use:  

    Step I:
    --------
    File --> Import --> URI (https://github.com/OpenSRP/opensrp-server.git)

    Step II:
    ---------
    File --> Import --> from localRepository (after cloning as directed above)
  3. For data storage system install No-SQL and browser based database server CouchDB. CouchDB 1.2 is recommended. As CouchDB is installed fromlinuxstore so its version is depended on linux version. To install CouchDB run the following command from terminal:

    sudo apt-get install couchdb

    Browse in the url : http://localhost:5984/_utils

    As alternative to install from linux apt-get, install from source also offers more flexibility and cleaner install.

    Install CouchDB prequisites

    $ sudo apt-get install g++
    $ sudo apt-get install erlang-base erlang-dev erlang-eunit erlang-nox
    $ sudo apt-get install libmozjs185-dev libicu-dev libcurl4-gnutls-dev libtool
     

    Then go to CouchDB site and choose to download from sources. After download CouchDB, extract it to your preferred folder.

    In a terminal, go to the folder where you extract your CouchDB and run the following command


    $ ./configure
    $ make
    $ sudo make install 

    Start CouchDB

    $ sudo couchdb
    Apache CouchDB 1.2.0 (LogLevel=info) is starting.
    Apache CouchDB has started. Time to relax.
    [info] [<0.32.0>] Apache CouchDB has started on http://127.0.0.1:5984/

    Setting CouchDB as service
    If you don't want to run your CouchDB everytime you boot your PC then install it as a service. CouchDB service will run CouchDB programs on PC startup.

    Add CouchDB User and Group

    $ sudo adduser --disabled-login --disabled-password --no-create-home couchdb
    Adding user `couchdb' ...
    Adding new group `couchdb' (1001) ...
    Adding new user `couchdb' (1001) with group `couchdb' ...
    Not creating home directory `/home/couchdb'.
    Changing the user information for couchdb
    Enter the new value, or press ENTER for the default
     Full Name []: CouchDB Admin
     Room Number []:
     Work Phone []:
     Home Phone []:
     Other []:
    Is the information correct? [Y/n] Y
    $

    Set owner for files and folders

    $ sudo chown -R couchdb:couchdb /usr/local/var/log/couchdb
    $ sudo chown -R couchdb:couchdb /usr/local/var/lib/couchdb
    $ sudo chown -R couchdb:couchdb /usr/local/var/run/couchdb

    Link CouchDB service script to /etc/init.d
    $ sudo ln -s /usr/local/etc/init.d/couchdb  /etc/init.d

    Configure service to start when enter or change levels

    $ sudo update-rc.d couchdb defaults
     Adding system startup for /etc/init.d/couchdb ...
       /etc/rc0.d/K20couchdb -> ../init.d/couchdb
       /etc/rc1.d/K20couchdb -> ../init.d/couchdb
       /etc/rc6.d/K20couchdb -> ../init.d/couchdb
       /etc/rc2.d/S20couchdb -> ../init.d/couchdb
       /etc/rc3.d/S20couchdb -> ../init.d/couchdb
       /etc/rc4.d/S20couchdb -> ../init.d/couchdb
       /etc/rc5.d/S20couchdb -> ../init.d/couchdb

     


  4. To use OpenSRP reporting module it needs to install PostgreSQL 9.1 or above. In OpenSRP previous architecture ANM location is managed by reporting module and reporting module used PostgreSQL server. Now in the current structure User, Provider and Location management are handled by OpenMRS. So, instead of reporting module OpenMRS instance is using for security management and reporting management. User authentication process is controlled by rest call from OpenSRP to OpenMRS. To install PostgreSQL execute the commands step by step

    apt-get update

    sudo apt-get install postgresql postgresql-contrib

    a) Connect to the default database with user postgres:
    sudo -u postgres psql template1

    b) Set the password for user postgres, then exit psql (Ctrl-D) :

    ALTER USER postgres with encrypted password 'xxxxxxx'; 

    c) Edit the pg_hba.conf file :

    sudo vi /etc/postgresql/9.1/main/pg_hba.conf

    And change "peer" to "md5" on the line concerningpostgres:

    local all postgres peer md5 

    d) Restart the database :

    sudo /etc/init.d/postgresql restart

    Whenpostgresqlservice stops use the command to start

    sudo service postgresql start

  5. For using JMS, Quartz, Motech etc. install we will need to install Apache ActiveMQ 
    To install Apache ActiveMQ download it from Apache ActiveMQ Site 
    Extract your download to your preferred folder, for example /home/apache-activemq or move it to /opt where optional software package are intendet intended to be placed

    sudo mv apache-activemq-x.x.x /opt

    Add some configuration to wrapper.conf file by the command

    sudo vi /opt/apache-activemq-x.x.x/bin/linux-x86-64/wrapper.conf

    In wrapper.conf configure home and base paths as your directory path and save

    set.default.ACTIVEMQ_HOME=/opt/apache-activemq-x.x.x

    set.default.ACTIVEMQ_BASE=/opt/apache-activemq-x.x.x

    Create To create an ActiveMQ service, create a soft link in init.d to create an ActiveMQ serviceusing the following command:

    sudo ln -s /opt/apache-activemq-x.x.x/bin/linux-x86-64/activemq /etc/init.d/activemq

     sudo service activemq  start

    To be ensured check the following urls:

    http://localhost:8161/fileserver/
     

  6. Install Maven 2 or above. In STS (Spring Tool Suite) maven is already integrated or it is possible to be installed from marketplace. To install from terminal execute the command:

    sudo apt-get install maven
    Run mvn clean install from the root directory of opensrp-server. It would be better if the command is execute from different module following dependency project hierarchy.Dependency hierarchy :If there are test failures, you can run the mvn clean install -Dmaven.test.skip=true to build and install all the different modules. It is also possible to build each module separately but this has to adhere to the dependency hierarchy i.e.

    a) opensrp-common

    b) opensrp-interface

    c) opensrp-api

    d) opensrp-form

    e) opensrp-core

    f) opensrp-register

    g) opensrp-connector

    h) opensrp-reporting (if applicable)

    e) opensrp-web

  7. To Install apache-tomcat server or jetty server. 
    a) Maven
        Navigate to opensrp-server/opensrp-reporting directory and run mvn jetty:run -Djetty.port=9980
        Navigate to opensrp-server/opensrp-web directory and run mvn jetty:run -Djetty.port=9979
    b) Plugin
        Install suitable version of jetty plugin from marketplace to run the application from editoryou can download it from tomcat apache site. You can follow this instructions to get it up and running.
  8. Install mysql using the instructions specified on the mysql documentation for your platform.
    Create and initialize the quartz database in mysql as follows:
    1. Create a user for the quartz and opensrp-web database applications
    2. Create the quartz database by running: CREATE DATABASE motechquartz; Ensure that the user you created has permission to this database.
    3. To create the database tables for the motechquartz database: mysql -u root -p"$MYSQL_ROOT_PASSWORD" "$MYSQL_MOTECH_DATABASE" < "$PATH_TO"/tables_quartz_mysql.sql
      View file
      nametables_quartz_mysql.sql
      height250
  9. Update the assets/config/opensrp.properties and opensrp-web/src/main/resources/quartz.properties with the mysql and couchdb credentials
  10. Once tomcat is running, you can install the opensrp.war file from opensrp-web into the webapps directory in order to run the application.

  11. Here is the OpenMRS installation guide line OpenMRS Installation

...