Version 11 (modified by joshuadf, 10 years ago) (diff)


OpenClinica Quick Install on Ubuntu 8.04 LTS

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 Ubuntu 8.04 LTS in a short amount of time.

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. Unfortunately the packages in RHEL5 are too old to support OpenClinica 3.0, and Ubuntu's tomcat6 bugs are serious as well. The best solution from my perspective is to use Ubuntu with newer PostgreSql and run Tomcat using jsvc, a generic java daemon program. Please note that since we are not using an OS pacakge for Tomcat, security updates are YOUR responsibility. You probably want to subscribe to the Apache Tomcat Announce mailing list.

See also OpenclinicaFedora for installation on Fedora.

# install Java separately first and agree to Sun license
aptitude -y install sun-java6-jdk
aptitude -y install postgresql postgresql-client jsvc

dpkg -l sun-java6-jdk jsvc postgresql
# Desired=Unknown/Install/Remove/Purge/Hold
# | Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend
# |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
# ||/ Name                                  Version                     Description
# +++-=====================================-===========================-===============================================
# ii  jsvc                                  1.0.2~svn20061127-6         wrapper to launch Java applications as daemons
# ii  postgresql                            8.3.8-0ubuntu8.04           object-relational SQL database (latest version)
# ii  sun-java6-jdk                         6-16-0ubuntu1.8.04          Sun Java(TM) Development Kit (JDK) 6

1b. Install tomcat

Next create places for Tomcat and OpenClinica, and download the latest Tomcat6. By default, Tomcat is not configured for encrypted (HTTPS) requests. To add this security, we can configure Tomcat to serve SSL requests by editing /etc/tomcat/server.xml to uncomment the SSL Connector port="8443" section, and then creating a keystore with a self-signed certificate for Tomcat as described below.

adduser --home /usr/local/tomcat --disabled-password --gecos "My tomcat" tomcat 
mkdir /usr/local/oc
mkdir /usr/local/tomcat/
chown tomcat /usr/local/tomcat/
# script for starting and stopping tomcat automatically
chmod 755 tomcat6-jsvc
update-rc.d tomcat6-jsvc defaults
cd /usr/local/oc
# current as of October 2009
su - tomcat
tar zxvf /usr/local/oc/apache-tomcat-6*.tar.gz 
mv apache-tomcat-6*/* .
# tomcat6-jsvc requires this JAR file 
ls -l /usr/local/tomcat/bin/bootstrap.jar
# create a self-signed SSL certificate
keytool -genkey -alias tomcat -keyalg RSA -dname "cn=Mark Jones, ou=JavaSoft, o=Sun, c=US" -storepass changeit -keypass changeit
# uncomment the `Connector port="8443"` section
nano conf/server.xml
/etc/init.d/tomcat6-jsvc start
# verify tomcat with SSL is now running
netstat -anp |grep 8443
# tcp6       0      0 :::8443                 :::*                    LISTEN      7649/jsvc       

If the netstat command does not show Tomcat running, check the logs at /usr/local/tomcat/logs/catalina.out. If it is running on port 8443 but you cannot see it at https://yourhost.tld:8443 check your firewall settings.

1c. Download and extract OpenClinica for Linux

Next Register at and get OpenClinica 3.0.0 (10/13/2009), or browse for the latest version at the OpenClinica Downloads website.

Upload your OpenClinica-*.tar.gz download to /usr/local/oc/ on your host with a command like rsync -vaz OpenClinica-*.tar.gz $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.

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.

2. Setup software

2a. PostgreSQL

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

# switch to postgres user       
su - postgres
  createuser --no-superuser --no-createrole --no-createdb --pwprompt clinica
  # type a strong password and note it!
  createdb --owner=clinica openclinica 
  psql -d openclinica -f /usr/local/oc/OpenClinica-*/config/database/PostgreSQL/*/install/create_database_*_tables_with_data.sql
# 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:

# 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/

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/tomcat5.5/server.xml. First uncomment the Connector port="8443" section, then create a keystore with a self-signed certificate for Tomcat. Note that Firefox and other browsers will display a "This Connection is Untrusted" error with the self-signed certificate.

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/

/etc/init.d/tomcat5.5 restart
# 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
rsync -az $PROP /usr/local/oc/
sed -i 's;*;;' $PROP
sed -i 's;adminEmail=.*;adminEmail=you@your.domain;' $PROP
nano $PROP # change your clinica DB password
/etc/init.d/tomcat6-jsvc 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:

  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/ 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.