OpenClinica User Manual/Ubuntu1010

Installing OC 3.0.4.1 on UBUNTU 10.10 Server
This document describes process of installing OpenClinica version 3.0.4.1 on the Linux UBUNTU Server version 10.10

To install Postgresql on Ubuntu10.10 do the following:

 * apt-get update
 * apt-get install postgresql-8.4
 * default TCP port for PostgreSQL: 5432
 * configuration files (for version 8.4): /etc/postgresql/*
 * cluster data (for version 8.4): /var/lib/postgresql/{version}/{cluster}/*
 * set up password for PostgreSQL account: postgres
 * su postgres
 * psql postgres
 * ALTER ROLE postgres WITH ENCRYPTED Password “yoursecretpassword”;
 * Login into PostgreSql database using new password: psql –hlocalhost –U postgres –W

If you want to setup Remote access for PostgreSql:
listen_address = “IP_address, localhost” and save Add following line: host	ALL	ALL	IP/mask	md5
 * Modify /etc/postgresql/{version}/{cluster}/postgresql.conf:
 * Modify /etc/postgresql/{version}/{cluster}/pg_hba.conf:
 * Restart PostgreSQL: service postgresql restart or /etc/init.d/postgresql restart
 * If you have firewall open port TCP 5432

If you want to check if postgresql is running:

 * netstat –ant | grep 5432
 * ps –aux | grep postgres
 * psql --version
 * chkconfig --list | grep postgresql

Apache Tomcat 6 and JDK 6
To install Tomcat 6 and JDK 6:
 * apt-get update
 * apt-get install openjdk-6-jdk tomcat6 tomcat6-admin tomcat6-common tomcat6-docs tomcat6-examples
 * Apache Tomcat 6 configuration files: /etc/tomcat6
 * CATALINA_BASE and CATALINA_HOME = /var/lib/tomcat6
 * TCP default port: 8080
 * http://ip_address:8080
 * JDK6:
 * JAVA_HOME: /usr/lib/jvm/
 * java –version // to check current version of JVM

At this stage we should have all required application installed on the system required for OpenClinica.

OpenClinica
OpenClincia application requires access to directory where e.g.CRFs, data extract sets etc will be stored once application is running. You can create this anywhere on your server as long as it is accessible by tomcat6 user (in this document by you may wish to create different user to run tomcat server). I e.g. have under /var/OpenClinica/ all the folders used by all the instances of OpenClinica installed on my server (it will make easier as well to do backup of your OpenClinica data).

General steps required to set up OpenClinica web application, data folder and PostgreSQL database:
 * 1) Please download version of OpenClinica you would like to install unzip and read installation notes (recommended).
 * 2) Create role, database on PostgreSQL database used by OpenClinica installation (appropriate scrips are included in the file you download from OpenClinica web site).
 * 3) Prepare data folder for OpenClinca and make sure that tomcat6 user can read and write to this location; You may create under: /var/OpenClinica/{OC_instancename}/ two folders:
 * 4) One with data for OpenClinica
 * 5) Second with logs for OpenClinica instance
 * 6) Deploy OpenClinica.war (by changing the name of the war file you can deploy more than one instance of OpenClinica on your Apache Tomcat 6 server)
 * 7) Either follow the instruction how to deploy war file on the Apache Tomcat 6 server or use Tomcat WE Application Manager
 * 8) Allow up to 1 minutes to deploy your new installation on the Apache Tomcat 6 server (it depends of course how much memory, and CPU has your server, check if java is doing by issuing top command):
 * 9) You should have under tomcat6 “webapps” folder with the OpenClinica instance
 * 10) Stop tomcat 6 server: service tomcat6 stop
 * 11) Edit file for your instance /var/lib/tomcat6/webapps/{OC_instanceName}/WEB-INF/classes/datainfo.properties
 * 12) You have to provide path to the OpenClinica data folder for this instance
 * 13) Username, password and database for PostgreSQL server
 * 14) Start tomcat6: service tomcat6 start

Depending on CPU and memory this step may take up to few minutes to finish (you may monitor activity of java process using top command tool) If everything went fine you should be able to access your instance: http://IP_tomcat6_server:8080/OpenClinica_instancename

Enable SSL support on Apache Tomcat 6
See: http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html

We will use SSL using APR (SSL self-signed server certificate and private key):
 * Install additional packages:
 * apt-get update
 * We install native library and APR libraries
 * apt-get install libtcnative-1 libapr1 libaprutil1
 * Edit tomcat 6 configuration file: /etc/tomcat6/server.xml
 * Enable APR listener
 * Enable SSL over APR:
 * Specify parameter for SSL connection
 * Path to the SSL server certificate
 * Path to the SSL server private key
 * Restart tomcat6 server: service tomca6 restart
 * netstat –ant | grep 8443 //check if sever is listening on the default 8443 TCP port for tomcat 6 for SSL connection

Backup

 * we have to backup the OpenClinica instance files
 * Apache Tomcat 6 configuration files
 * PostgreSql configuration files
 * Data folder for OpenClinica instance
 * Database for OpenClinica

Restore

 * Not done yet