Friday, December 25, 2015

Openclinica 3.8 installation on ubuntu 14.04 server

This week we worked on installing Openclinica for one of our client. The wiki page gives detailed steps but some things need to be added to that.

Here I am going to give detailed steps. Most of the steps copied from the wiki page.

1) The prerequisites are
ubuntu machine with following softwares installed
vim
unzip
tar
You require "root" user access. Run all commands in the installation instructions using root-level permission.

2) Install Java
Openclinica is based on Java.
#Create folder if it doesn't exist
mkdir -p /usr/local/oc/install 
#Change to this folder:
cd /usr/local/oc/install
#Download jdk into the above folder
#find the 32-bit version here: https://openclinica.app.box.com/oc-downloads/1/2186650849
#find the 64-bit version here: https://openclinica.app.box.com/oc-downloads/1/2186651363 
#Install Java by running:
tar -zxvf jdk-7* 
#Install Java in the operating system by running:
mv jdk1* /usr/local/
ln -s /usr/local/jdk1* /usr/local/java
 
After above steps test java installed by typing java and javac. If the command not found error occurs.
Then you need to update the alternatives by following commands
#To update java command alternatives
update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/bin/java" 1
#To update javac command alternatives
update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/bin/javac" 1
#To udate javaws command alternatives
update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/bin/javaws" 1

3) Install tomcat
#Create folder if it doesn't exist
mkdir -p /usr/local/oc/install

#Change to this folder:
cd /usr/local/oc/install

#Download tomcat into the above folder
wget https://dev.openclinica.com/oc/software/OpenClinica-3.2/linux/apache-tomcat-7.0.52.tar.gz

#Install Tomcat by running the following:
tar -zxvf apache-tomcat-*
mv apache-tomcat-* /usr/local/
ln -s /usr/local/apache-tomcat-7.0.52 /usr/local/tomcat
/usr/sbin/adduser tomcat

#Update the File Path parameter to the correct value
chown -R tomcat /usr/local/tomcat/*
chown -R tomcat /usr/local/apache-*
4) Install PostgreSql 
We have installed postgresql 9.3. Observed that 8.4 does not work with OpenClinica 3.8.

#Install postgresql
apt-get install postgresql

Then enter into the database to create a role and database for the openclinica.
# to connect to the localhost psql
psql -U postgres
If you get following error
psql: FATAL:  Peer authentication failed for user "postgres"
then
#Edit the /etc/postgresql/9.1/main/pg_hba.conf
local   all   postgres     peer
Should be
local   all   postgres     md5
 And restart the postgresql service
service postgresql restart
sudo -i -u postgres
psql
#Enter the password that is given at the time of installation
#Create role clinica with password clinica
CREATE ROLE clinica LOGIN ENCRYPTED PASSWORD 'clinica' SUPERUSER NOINHERIT NOCREATEDB NOCREATEROLE;
#Create database openclinica
CREATE DATABASE openclinica WITH ENCODING='UTF8' OWNER=clinica;
#To change the password of 'clinica' role
ALTER USER clinica WITH PASSWORD 'newpassword';
#Exit the psql command prompt by typing
\q

5) Deploying OpenClinica within tomcat
#Create folder if it doesn't exist
mkdir -p /usr/local/oc/install

#Change to this folder:
cd /usr/local/oc/install

# Download the OpenClinica software from the OpenClinica 
# website: https://community.openclinica.com/project/openclinica. 
# To download the software, you need an OpenClinica community user account, 
# which is free to create; you will be required to log in to the account to download the
# OpenClinica software.

#Run the following commands. In the commands, v.x is your version of OpenClinica:
unzip OpenClinica-v.x*
cd OpenClinica-v.x*/distribution
unzip OpenClinica.war -d OpenClinica
cp -rf OpenClinica* /usr/local/tomcat/webapps
6) Configure the Openclinica application
If you followed all the previous instructions exactly, there is only one property in the configuration file, datainfo.properties, that you may need to change in order for OpenClinica to start. There are other properties in the configuration file you will probably want to modify for your system.
The first time you install OpenClinica you will configure datainfo.properties here: /usr/local/tomcat/webapps/OpenClinica/WEB-INF/classes/datainfo.properties. Consequent configuration changes SHOULD be made here /usr/local/tomcat/webapps/openclinica.config.
  1. Open the configuration file: /usr/local/tomcat/webapps/OpenClinica/WEB-INF/classes/datainfo.properties
  2. Edit values for the properties in the datainfo.properties file. You must change the value for dbPass to the password you selected in Set Up the PostgreSQL Database. Change the values for any other properties, then save the file.
  3. Update the filePath parameter to the right value.
  4. Run the following commands:
7) Start the tomcat
#To set Tomcat to start automatically on system startup, run the following: 
cp /usr/local/oc/install/OpenClinica-v.x*/install-docs/linux/tomcat /etc/init.d/
cd /etc/init.d
chmod a+x /etc/init.d/tomcat
#update the rc.d
update-rc.d tomcat defaults
service tomcat start

8) Go to http://{ubuntu-server-ip}:8080/OpenClinica/
default username : root
default password  : 12345678

After creating a user the password is shown under alerts&messages left panel.

 

2 comments:

  1. when ever openclinica is not working its because database communication issue so you need reinstall postresql by follow few steps:


    List All Postgres related packages

    dpkg -l | grep postgres

    ii postgresql 8.3.17-0ubuntu0.8.04.1 object-relational SQL database (latest versi
    ii postgresql-8.3 8.3.9-0ubuntu8.04 object-relational SQL database, version 8.3
    ii postgresql-client 8.3.9-0ubuntu8.04 front-end programs for PostgreSQL (latest ve
    ii postgresql-client-8.3 8.3.9-0ubuntu8.04 front-end programs for PostgreSQL 8.3
    ii postgresql-client-common 87ubuntu2 manager for multiple PostgreSQL client versi
    ii postgresql-common 87ubuntu2 PostgreSQL database-cluster manager
    ii postgresql-contrib 8.3.9-0ubuntu8.04 additional facilities for PostgreSQL (latest
    ii postgresql-contrib-8.3 8.3.9-0ubuntu8.04 additional facilities for PostgreSQL

    Remove all above listed

    sudo apt-get --purge remove postgresql postgresql-8.3 postgresql-client postgresql-client-8.3 postgresql-client-common postgresql-common postgresql-contrib postgresql-contrib-8.3

    Remove the following folders

    sudo rm -rf /var/lib/postgresql/
    sudo rm -rf /var/log/postgresql/
    sudo rm -rf /etc/postgresql/

    and after that install postresql by following this commands:
    sudo apt-get update
    sudo apt-get install postgresql postgresql-contrib

    sudo -i -u postgres
    psql

    ReplyDelete
  2. I followed this exactly, and all I get is a blank screen.

    The logs are showing:

    May 09, 2016 3:41:55 PM org.apache.catalina.startup.HostConfig deployWAR
    INFO: Deploying web application archive /usr/local/apache-tomcat-7.0.52/webapps/OpenClinica.war
    May 09, 2016 3:41:55 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
    INFO: validateJarFile(/usr/local/tomcat/webapps/OpenClinica/WEB-INF/lib/servlet-api-2.3.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
    May 09, 2016 3:42:06 PM org.apache.catalina.startup.TaglibUriRule body
    INFO: TLD skipped. URI: http://code.google.com/p/jmesa is already defined
    May 09, 2016 3:42:11 PM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error listenerStart
    May 09, 2016 3:42:11 PM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Context [/OpenClinica] startup failed due to previous errors


    Any help?

    ReplyDelete