Install OpenCRX with PostgreSQL and Ubuntu 10.04

If you want to install OpenCRX 2.8.5 with a Postgres database, you have to do some additional steps during the installation. The general installation steps are described at OpenCRX 2.8.5 Install. Here comes the short description with the additional changes for the Postgres database.

First, you have to install the Java JDK 6 and Ant 1.8.0 (Use 1.8.0 -> important). You can download the JDK 6 from here and the necessary Ant files at Apache Ant. If you have installed Ant via the package installer of Ubuntu, you can get information about Ant by typing the following line in a terminal:

ant -diagnostics

You'll see some information about the installed version of Ant. The ant.home parameter contains the path to the installed Ant version. At my system it is:

/usr/share/ant

Next, you have to download the OpenCRX Server Installer from http://www.opencrx.org/downloads.htm. I had to download the following file:

opencrxServer-2.8.5-linux-x64-installer.bin

Launch the installer and finish the installation process. The following line starts the installer:

./opencrxServer-2.8.5-linux-x64-installer.bin

The installation wizard is nearly self explaining. Click through the questions and finish the installtion.

Let's create the Postgres database. Create a new Postgres user (e.g. crx) and a new database with the name CRX_CRX.

The database must be filled with the basic scripts from the opencrxSDK. You can download the SDK from OpenCRX SDK. Install the SDK and fill the database with the scripts from:

opencrxSdk-2.8.5/opencrx-2.8.5/core/src/sql/postgresql-8

We only need the scripts from the SDK, nothing more. If the installation of the SDK does not work properly without errors, no matter. We do not need a working SDK.

You have to execute the following scripts in the given order:

  1. dbcreate-tables.sql
  2. dbcreate-views.sql
  3. dbcreate-indexes.sql
  4. populate-preferences.sql

A complete overview of the Postgres installation process can be found at OpenCRX Postgres Installation.

The OpenCRX Server uses Tomcat and needs the PostgreSQL library to work properly. You can download the necessary .jar file from PostgreSQL JAR. For my system it was:

postgresql-8.4-703.jdbc4.jar

The postgresql-8.4-703.jdbc4.jar must be copied into the lib folder of the Tomcat system which is at:

<PATH_TO_OPENCRXSERVER>/opencrxServer-2.8.5/apache-tomcat-6.0.29/lib

We are nearly done. Finally, we have to change the configuration files to use our created Postgres database. By default, OpenCRX uses a HSQLDB which is working fine but should not be used in a production system. Let's do it.

Tell the Tomcat to use the PostgreSQL driver and the necessary database parameters. You find the openejb.xml file at:

<PATH_TO_OPENCRXSERVER>/opencrxServer-2.8.5/apache-tomcat-6.0.29/conf/openejb.xml

Uncomment the part with the PostgreSQL driver and comment out the HSQLDB part. The important lines are:

 <Resource id="jdbc_opencrx_CRX" type="DataSource">
  JdbcDriver org.postgresql.Driver
  JdbcUrl jdbc:postgresql://localhost/CRX_CRX
  UserName crx
  Password YOUR_PASSWORD
  JtaManaged true
 </Resource>

The second configuration file is situated at:

<PATH_TO_OPENCRXSERVER>/opencrxServer-2.8.5/bin/opencrx.sh

Comment out the HSQLDB starting lines:

# Start HSQLDB
#if [ -e /home/andre/opencrx_20111202/opencrxServer-2.8.5/data/crx_2_8/startdb.sh ] ; then 
#  /home/andre/opencrx_20111202/opencrxServer-2.8.5/data/crx_2_8/startdb.sh START &
#  sleep 3
#fi

Change the database configuration to:

export JAVA_OPTS="$JAVA_OPTS -Dopencrx.CRX.jdbc.driverName=org.postgresql.Driver"
export JAVA_OPTS="$JAVA_OPTS -Dopencrx.CRX.jdbc.url=jdbc:postgresql://localhost/CRX_CRX"
export JAVA_OPTS="$JAVA_OPTS -Dopencrx.CRX.jdbc.userName=crx"
export JAVA_OPTS="$JAVA_OPTS -Dopencrx.CRX.jdbc.password=YOUR_PASSWORD"

Do not add the following additional option for enhanced performance (login does not work anymore):

export JAVA_OPTS="$JAVA_OPTS -Dorg.openmdx.persistence.jdbc.useLikeForOidMatching=false"

Comment out the HSQLDB stop part:

# Stop HSQLDB
#if [ -e /home/andre/opencrx_20111202/opencrxServer-2.8.5/data/crx_2_8/startdb.sh ] ; then 
#  /home/andre/opencrx_20111202/opencrxServer-2.8.5/data/crx_2_8/startdb.sh STOP
#fi

Done. We made it. You can start the OpenCRX Server with the following command:

sh opencrx.sh START

Launch the browser and see the login page at:

localhost:8080/opencrx-core-CRX/