Monday, January 4, 2016

Install Java 8 and Tomcat 7 as service for DHIS2

Java installation

Oracle Java 8 JDK is the recommended Java option as it provides the greates operating system support, including Ubuntu LTS 14.04. The webupd8team Java PPA provides the necessary packages.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Check that your installation is okay by

java -version

You can also ensure that the appropriate environment variables are set by installing this package

sudo apt-get install oracle-java8-set-default

Install Tomcat

To install the Tomcat servlet container install Tomcat package by invoking:

sudo apt-get install tomcat7

Install tomcat admin package and other common package

sudo apt-get install tomcat7-docs tomcat7-admin tomcat7-examples

Next edit the environment file by 

sudo nano /usr/share/tomcat7/bin/setenv.sh

Add the lines below. The first line will set the location of your Java Runtime Environment, the second will dedicate memory to Tomcat and the third will set the location for where DHIS 2 will search for the dhis.conf configuration file. 

export JAVA_HOME='/usr/lib/jvm/java-8-oracle/'
export JAVA_OPTS='-Xmx7500m -Xms4000m'
export DHIS2_HOME='/home/dhis/config'

If tomcat service not started, uncomment the JAVA_HOME entry in /etc/default/tomcat7 and adjust the path accordingly. For our case update JAVA_HOME=/usr/lib/jvm/java-8-oracle.

No comments:

Post a Comment