wiki:OpenClinicaRedHat
Last modified 8 years ago Last modified on 10/13/09 16:38:03

OpenClinica Quick Install on Red Hat

This "quickstart" guide is a condensed version of the verbose instructions found in the OpenClinica download at install-docs/linux/install.txt. It should allow you to get OpenClinica installed on a fully updated install of Red Hat Enterprise Linux 5 Update 3 (EL5.3) in a short amount of time.

Note: For Sun Java, you may need to add the channel "RHEL Supplementary (v. 5)" in the RHN web interface, or separately install and configure a JDK as described in the OpenClinica instructions. We prefer to use standard RHEL components when possible to take advantage of Red Hat's security/QA process. EL5.3's version of postgres is slightly older than in the OpenClinica recommendations, but Red Hat backports updates. Warning: we have experienced some issues with dataset extracts related to PostgreSql version.

See also OpenclinicaFedora for installation on Fedora.

1. Download and install software.

1a. Install prerequisite software

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

rpm -q tomcat5 postgresql java-1.6.0-sun
# As of 2009 Mar 19
# tomcat5-5.5.23-0jpp.7.el5_2.1
# postgresql-8.1.11-1.el5_1.1
# java-1.6.0-sun-1.6.0.12-1jpp.3.el5

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/tomcat5/openclinica.data
chown tomcat:tomcat /var/lib/tomcat5/openclinica.data
ln -s /var/lib/tomcat5/openclinica.data /usr/share/tomcat5
ln -s /usr/share/tomcat5 /usr/local/tomcat
mkdir /usr/local/oc

Next Register at OpenClinca.org and get latest version at the OpenClinica Downloads website.

Upload your OpenClinica-*.tar.gz download to /usr/local/oc/ on your EL5 host with a command like rsync -vaz OpenClinica-*.tar.gz $RHEL_HOST:/usr/local/oc/.

Now, on your EL5 host, decompress the download :

cd /usr/local/oc
tar zxvf OpenClinica-*.tar.gz 

Make sure you only have one /usr/local/oc/OpenClinica-* directory or some of the commands below will fail. If you have older versions of OpenClinica you can move them to an oldversions/ directory.

2. Setup software

2a. PostgreSQL

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

/etc/init.d/postgresql start
chkconfig postgresql on
# change localhost access type to "md5" 
sed -i 's;127.0.0.1/32          ident sameuser;127.0.0.1/32          md5;' /var/lib/pgsql/data/pg_hba.conf
# switch to postgres user       
su - postgres
  createuser --no-superuser --no-createrole --no-createdb --pwprompt clinica
  # type a strong password and note it!
  createdb openclinica 
  psql -d openclinica -f /usr/local/oc/OpenClinica-*/config/database/PostgreSQL/*/install/create_database_*_tables_with_data.sql
exit
/etc/init.d/postgresql restart
# test the connection from localhost -- type your strong password 
psql --user clinica --host localhost openclinica

2b. Tomcat

Below are several small Tomcat configuration changes, bugfixes, and workarounds:

# set tomcat to start automatically on boot
chkconfig tomcat5 on

# install postgresql JDBC driver per OpenClinica instructions
cp /usr/local/oc/OpenClinica-*/config/libraries/postgresql-8.1-405.jdbc3.jar /usr/local/tomcat/common/lib/

# remove problematic impl jars; this must be done after each Red Hat tomcat update
# or OpenClinica rule import will fail with "Cannot find the declaration of element 'RuleImport'"
rm -f /usr/local/tomcat/common/endorsed/*
# Bug: https://bugzilla.redhat.com/show_bug.cgi?id=217630
wget https://staff.washington.edu/joshuadf/java/naming-factory-dbcp.jar -O /var/lib/tomcat5/common/lib/naming-factory-dbcp.jar
# Open``Clinica is only compatible with Sun Java``Mail http://java.sun.com/products/javamail/
wget https://staff.washington.edu/joshuadf/java/mail.jar -O /usr/share/java/mail.jar
/usr/sbin/alternatives --install /usr/share/java/javamail.jar javamail /usr/share/java/mail.jar 4289
/usr/sbin/alternatives --set javamail /usr/share/java/mail.jar 

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/

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

2c. OpenClinica Deployment

# pre-deploy the WAR; we will edit some files before restarting Tomcat
cp /usr/local/oc/OpenClinica-*/distribution/OpenClinica.war /usr/local/tomcat/webapps 

Lastly, in /usr/local/tomcat/conf/Catalina/localhost/OpenClinica.xml change the JDBCRealm and SQLPostgres password lines for the "clinica" user to your db password and then run

# change OpenClinica settings
sed -i 's;smtpHost=mail.example.com;smtpHost=localhost;' /usr/local/tomcat/webapps/OpenClinica/properties/datainfo.properties
sed -i 's;adminEmail=.*;adminEmail=you@your.domain;' /usr/local/tomcat/webapps/OpenClinica/properties/datainfo.properties
/etc/init.d/tomcat5 restart

Now go to https://localhost: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.