wiki:OpenClinicaCentOS
Last modified 7 years ago Last modified on 08/11/11 15:28:21

OpenClinica Quick Install on CentOS 6

This "quickstart" guide is a condensed version of the verbose instructions found at https://docs.openclinica.com/ OpenClinica. It should allow you to get OpenClinica installed on a fully updated install of CentOS 6 or Red Hat Enterprise Linux 6. This was last tested with Red Hat Enterprise Linux 6 Update 1 (EL6.1) in August 2011.

Note: For Sun Java, you may need to add the channel "RHEL Supplementary" in the RHN web interface, or separately install and configure a JDK as described in the OpenClinica instructions.

OpenClinica(R), OpenClinica Enterprise(TM), and Akaza Research(R) are trademarks of Akaza Research LLC.

The party providing this guide to installing OpenClinica is not a certified partner, reseller, or affiliate of Akaza Research LLC, and is not certified, approved, or sponsored by Akaza Research LLC in connection with installation, operation, maintenance or support of the OpenClinica software platform, the OpenClinica Enterprise software platform or any other Akaza products.

1. Download and install software.

1a. Install software supplied by operating system vendor

Operating systems such as Ubuntu or Red Hat Enterprise Linux supply conveniently packaged software that tracks security updates, so I use it whenever possible.

# install Java separately first because there are multiple options (Sun, IBM, BEA)
yum -y install java-1.6.0-sun
yum -y install postgresql-server tomcat6-admin-webapps

rpm -q postgresql-server tomcat6-admin-webapps java-1.6.0-sun
# postgresql-server-8.4.7-2.el6.x86_64
# tomcat6-admin-webapps-6.0.24-33.el6.noarch
# java-1.6.0-sun-1.6.0.26-1jpp.1.el6.x86_64

1b. Download and extract OpenClinica for Linux

First we'll set up links so that both Red Hat's default OS tools and OpenClinica install.txt instructions will work. In short the downloads will live in /usr/local/oc/ while the live webapp and data will be visible as /usr/local/tomcat/ but really live in /var/lib/tomcat5/ per Linux Standard Base (LSB).

mkdir /var/lib/tomcat6/openclinica.data
chown tomcat:tomcat /var/lib/tomcat6/openclinica.data
ln -s /var/lib/tomcat6/openclinica.data /usr/share/tomcat6
ln -s /usr/share/tomcat6 /usr/local/tomcat
mkdir /usr/local/oc

Next Register at OpenClinca.org and get OpenClinica 3.1.1 (26-Jul-2011), or browse for the latest version at the OpenClinica Downloads website.

Upload your OpenClinica-*.zip download to /usr/local/oc/ on your host with a command like rsync -vaz OpenClinica-*.zip $LINUX_HOST:/usr/local/oc/.

Now, on your host, decompress the download. If you have older versions of OpenClinica you can first move them to an oldversions/ directory. Make sure you only have one /usr/local/oc/OpenClinica-3* directory or some of the commands below will fail.

cd /usr/local/oc
unzip OpenClinica-3*.zip

2. Setup software

2a. PostgreSQL

If you have not already done so, initialize the PostgreSql server:

chkconfig postgresql on
/etc/init.d/postgresql initdb
# allow local JDBC connections
sed -i 's;127.0.0.1/32.*;127.0.0.1/32          md5;' /var/lib/pgsql/data/pg_hba.conf
/etc/init.d/postgresql start

Prepare a strong password to use for the db user and run the following:

# switch to postgres user       
su - postgres  
  # replace 'clinica' with a strong password and note it, or later run "ALTER USER clinica WITH PASSWORD 'XXXX';"
  psql -U postgres -c "CREATE ROLE clinica LOGIN ENCRYPTED PASSWORD 'clinica' SUPERUSER NOINHERIT NOCREATEDB NOCREATEROLE"
  psql -U postgres -c "CREATE DATABASE  openclinica WITH ENCODING='UTF8' OWNER=clinica"
exit
# test the connection from localhost -- type your strong password 
psql --user clinica --host localhost openclinica

2b. Tomcat

By default, Tomcat is not configured for encrypted (HTTPS) requests. If you want to pass requests through an Apache httpd server, see ApacheConfig for details. Alternatively you can configure Tomcat to serve SSL requests by editing /etc/tomcat/server.xml. First uncomment the Connector port="8443" section, then create a keystore with a self-signed certificate for Tomcat:

keytool -genkey -alias tomcat -keyalg RSA -dname "cn=Mark Jones, ou=JavaSoft, o=Sun, c=US" -storepass changeit -keypass changeit
mv /root/.keystore /usr/local/tomcat/
cp /usr/local/oc/OpenClinica-3*/distribution/OpenClinica.war /usr/local/tomcat/webapps 
chown -R tomcat:tomcat /usr/local/tomcat

chkconfig tomcat6 on
service tomcat6 start
# verify it is now running
netstat -anp |grep 8443
# tcp        0      0 :::8443                     :::*                        LISTEN      581/java   

Lastly, we will change /usr/local/tomcat/webapps/OpenClinica/WEB-INF/classes/datainfo.properties to your db password, email address, and other settings.

# make a backup copy first
PROP=/usr/local/tomcat/webapps/OpenClinica/WEB-INF/classes/datainfo.properties
rsync -az $PROP /usr/local/oc/datainfo.properties.orig
nano $PROP # change your clinica DB password and other settings
/etc/init.d/tomcat6 stop
/etc/init.d/tomcat6 start

Now go to https://yourhost.tld:8443/OpenClinica/MainMenu (root/12345678) and enjoy! If you cannot log in, check the log files in /usr/local/tomcat/logs/ for details.

Debugging OpenClinica

There are many places to find logs of errors occurring in OpenClinica. Ideally users will see helpful messages, but sometimes it is a generic message. For example, one of our users had a created a CRF with different RESPONSE_OPTIONS_TEXT columns, but identical RESPONSE_LABEL columns. When trying to preview the CRF, OpenClinica simply output "An error has occurred in the application."

I found the following message in the tomcat log /usr/local/tomcat/logs/catalina.out:

java.util.MissingResourceException: 
  Can't find resource for bundle java.util.PropertyResourceBundle, key resp_label_with_different_resp_values_html_error

I searched for the internationalization properties files in the webapp

grep -lrsi resp_label /usr/local/tomcat/webapps/OpenClinica/

I found the default file at /usr/local/tomcat/webapps/OpenClinica/WEB-INF/classes/org/akaza/openclinica/i18n/page_messages.properties and edited it with a text editor to add the resp_label_with_different_resp_values_html_error key:

resp_label_with_different_resp_options=RESPONSE_OPTIONS_TEXT can not be different for the same RESPONSE_LABEL. Error on row
resp_label_with_different_resp_values=REPONSE_VALUES can not be different for the same RESPONSE_LABEL. Error on row
resp_label_with_different_resp_values_html_error=REPONSE_VALUES can not be different for the same RESPONSE_LABEL. Error on row

You may also want to read about query debugging at our PostgreSql page.