Last modified 7 years ago Last modified on 04/21/11 16:13:29

OpenClinica Quick Install on Ubuntu 10.04 LTS "Lucid"

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 10.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 Ubuntu's tomcat6 bugs are serious. The best solution from my perspective is to use Ubuntu's PostgreSql and run Tomcat using jsvc, a generic java daemon program. Please note that since we are not using an OS package 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.

# enable "partner" software and agree to Java license first 
apt-get -y install python-software-properties
add-apt-repository "deb lucid partner"
apt-get update
aptitude -y install sun-java6-jdk
# accept terms
update-java-alternatives -s java-6-sun

# now Postgres database and JSVC for running Tomcat service
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. You may also want to remote the Connector port="8080" section to disable unencrypted logins.

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
mv tomcat6-jsvc /etc/init.d/
update-rc.d tomcat6-jsvc defaults
cd /usr/local/oc
# current as of April 2011
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 (07-Apr-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 zxvf OpenClinica-3*.zip

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 --superuser --no-createrole --no-createdb --pwprompt clinica
  # type a strong password and note it!
  createdb --owner=clinica openclinica 
# test the connection from localhost -- type your strong password 
psql --user clinica --host localhost openclinica

2b. Tomcat

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

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

# make a backup copy first
rsync -az $PROP /usr/local/oc/
nano $PROP # change your clinica DB password and other settings
/etc/init.d/tomcat6-jsvc stop
/etc/init.d/tomcat6-jsvc 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:

  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.