OpenSRP is an open source project that uses multiple platforms.
For a full server build you will need to install the technology components/programs to install OpenSRP.
JDK 1.6 or above (1.7 is recommended)
Development Editor
CouchDB - port :5984. (Remember to put properties file, bean id and configure in appcontext of spring); /start couchDB
PostgresSQL 9.1 or above (Install as a service since its only used for reporting) - Port: 5432; /start postgres windows service
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
- Mysql 5.6 or above (This is required by the Quartz plugin and opensrp-web)
- Maven 2 or above
Apache-Tomcat 6 or above
OpenMRS
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).
- 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-openjdk-amd64/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. /usr/lib/jvm/java-7-openjdk-amd64)
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 hereClone 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)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.dConfigure 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
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 template1b) 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
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 intended to be placed
sudo mv apache-activemq-x.x.x /opt
Add some configuration to wrapper.conf file by the commandsudo 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
To create an ActiveMQ service, create a soft link in init.d using 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:
Install Maven 2 or above. To install from terminal execute the command:
sudo apt-get install maven
Runmvn clean install
from the root directory of opensrp-server. 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
- To Install apache-tomcat you can download it from tomcat apache site. You can follow this instructions to get it up and running.
- Install mysql using the instructions specified on the mysql documentation for your platform.
Create and initialize the quartz database in mysql as follows:- Create a user for the quartz and opensrp-web database applications
- Create the quartz database by running: CREATE DATABASE motechquartz; Ensure that the user you created has permission to this database.
- 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
- Update the assets/config/opensrp.properties and opensrp-web/src/main/resources/quartz.properties with the mysql and couchdb credentials
- Once tomcat is running, you can install the opensrp.war file from opensrp-web into the webapps directory in order to run the application.
- Here is the OpenMRS installation guide line OpenMRS Installation