We hope you'll join us for our 4/23 webinar on using data tables to apply reference ranges and AE codes in OC4. For more information and to register, visit https://register.gotowebinar.com/register/2882170018956684555

Installing OC 3.14 in Ubuntu Server 18.10

I have just gone through installing OpenClinica 3.14 on Ubuntu server 16.10 and thought people here might make use of my notes (and/or offer suggestions for improvement). This successfully works in a VMWare virtual machine assigned with 2 Gig RAM.

# WARNING: be VERY careful with versions of supporting apps.
# Openclinica 3.14
# JDK 1.8
# PostgreSQL 9.5
# Tomcat 7

# Update ubuntu software
sudo apt-get update
sudo apt-get dist-upgrade
# Update ubuntu root password
sudo passwd root
# install unzip
sudo apt-get install unzip

##########
# Install Java
# https://askubuntu.com/questions/761127/how-do-i-install-openjdk-7-on-ubuntu-16-04-or-higher
#NOT MOST RECENT VERSION sudo apt-get install default-jre
# Cheating with debian package installer
sudo apt-get install dpkg

# Create file: /etc/apt/preferences.d/debian
sudo pico /etc/apt/preferences.d/debian
# with contents as per
# https://askubuntu.com/questions/761127/how-do-i-install-openjdk-7-on-ubuntu-16-04-or-higher
## ----------- follow text is contents of file

Package: *
Pin: release o=Debian,n=experimental
Pin-Priority: -1

Package: *
Pin: release o=Debian,n=sid
Pin-Priority: -1

Package: openjdk-7-jdk
Pin: release o=Debian,n=experimental
Pin-Priority: 500

Package: openjdk-7-jre
Pin: release o=Debian,n=experimental
Pin-Priority: 500

Package: openjdk-7-jre-headless
Pin: release o=Debian,n=experimental
Pin-Priority: 500

Package: libjpeg62-turbo
Pin: release o=Debian,n=sid
Pin-Priority: 500

## ----------- end text (exclude this line)

sudo apt install debian-archive-keyring
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010
sudo add-apt-repository 'deb http://httpredir.debian.org/debian experimental main'
sudo add-apt-repository 'deb http://httpredir.debian.org/debian sid main'
sudo apt update
# sudo apt install openjdk-7-jdk
sudo apt install openjdk-8-jdk
# test what version is active
java -version
# 1.8 should be the default, but sometimes for some reason, v11 gets installed
update-java-alternatives --list
sudo update-java-alternatives -s java-1.8.0-openjdk-amd64
# test version
java -version

##########
# TOMCAT
# Install tomcat
sudo add-apt-repository 'deb http://us.archive.ubuntu.com/ubuntu/ xenial main'
sudo add-apt-repository 'deb http://us.archive.ubuntu.com/ubuntu/ xenial universe'
sudo apt-get update
sudo apt-get install tomcat7
sudo apt-get install tomcat7-admin
sudo apt-get install tomcat7-docs
# optional: apt-get install tomcat7-examples

sudo pico /var/lib/tomcat7/conf/tomcat-users.xml
# EDIT in tomcat user into the above file
## ----------- follow text inserted into xml under



## ----------- end text (exclude this line)

systemctl restart tomcat7

# Tomcat cmd control
systemctl start tomcat7
systemctl stop tomcat7
systemctl restart tomcat7

# Tomcat test (Change to your IP)
# web browser http://172.23.75.64:8080/

# tomcat index.html in /var/lib/tomcat8/webapps/ROOT
cd ~
sudo ln -s /var/lib/tomcat7/webapps/ROOT web
sudo ln -s /var/lib/tomcat7/logs logs

# Permissions
## probably not necessary as tomcat7 is created automatically: adduser tomcat
# chown -R tomcat /var/lib/tomcat7/*
chown -R tomcat7 /var/lib/tomcat7/*

##########
# POSTGRESS
sudo apt-get install postgresql-9.5
sudo apt-get install postgresql-client-9.5

# Change user account to postgress // use exit or logout
sudo -i -u postgres
# CREATE ROLE
psql -U postgres -c "CREATE ROLE clinica LOGIN ENCRYPTED PASSWORD 'clinica' SUPERUSER NOINHERIT NOCREATEDB NOCREATEROLE"
# CREATE DATABASE
psql -U postgres -c "CREATE DATABASE openclinica WITH ENCODING='UTF8' OWNER=clinica"
# CHANGE PASSWORD
psql -U postgres
ALTER USER clinica WITH PASSWORD 'XXXX';
\q
exit

##########
# OPENCLINICA
su
mkdir -p ~/tmp
cd ~/tmp
# can't download OpenClinica directly because they place login auth on the page
# grab the software and place elsewhere that is web accessible
# or use vmware tools to connect to a shared folder
curl -O http://your.domain.com/tmp/OpenClinica-3.14.zip
unzip OpenClinica-3.14.zip
cd ~/tmp/OpenClinica-3.14/distribution
unzip OpenClinica.war -d OpenClinica
# create new web app : copy war file and the folder
cp -rf OpenClinica* /var/lib/tomcat7/webapps
mkdir /var/lib/tomcat7/OpenClinica.data/
mkdir /var/lib/tomcat7/OpenClinica.attached/

chown -R tomcat7 /var/lib/tomcat7/*
chown -R tomcat7 /usr/share/tomcat7

# For first install
pico /var/lib/tomcat7/webapps/OpenClinica/WEB-INF/classes/datainfo.properties
# For subsequent alterations
pico /usr/share/tomcat7/openclinica.config/datainfo.properties

# dbType=postgres
# dbUser=clinica
# dbPass=XXXX
# db=openclinica
# dbPort=5432
# dbHost=localhost
#
# filePath=/var/lib/tomcat7/OpenClinica.data/
#
# attached=/var/lib/tomcat7/OpenClinica.attached/
#
# [email protected]
#
# mailHost=smtp.your.domain.com
# mailPort=25
# mailProtocol=smtp
# mailUsername=
# mailPassword=
# mailSmtpAuth=false
# mailSmtpStarttls.enable=false
# mailSmtpsAuth=false
# mailSmtpsStarttls.enable=false
# mailSmtpConnectionTimeout=100
# [email protected]
#
# sysURL=http://localhost:8080/OpenClinica/MainMenu

cp /var/lib/tomcat7/webapps/OpenClinica/WEB-INF/classes/datainfo.properties ~/

# Start OpenClinica (Change to your IP)
http://172.23.74.227:8080/manager/html
# If errors then investigate logs because the error on the web page is exceedingly uninformative
# Likely: folder permissions, postgres login issue

# OPENCLINICA! (Change to your IP)
http://172.23.74.227:8080/OpenClinica
# Log in as username: root password: 12345678
# Tasks > Users > Create New User
# Create a technical administrator account

##########
# LOGS [useful when things go wrong]
# /var/log/tomcat7
cd /var/lib/tomcat7/logs
less -S /var/lib/tomcat7/logs/localhost.

##########
# WEB PAGE [optional]
# Change the ugly tomcat page with this slightly less ugly page
pico /var/lib/tomcat7/webapps/ROOT/index.html

## ----------- Replace existing text with text below

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


OpenClinica Community Edition


H1 {font-family: Calibri, sans-serif; font-weight: bold; font-size: 1.2em}
body {font-family:calibri, arial, sans-serif; font-size:1em;}



OpenClinica Community Edition


Community forums
Tech doc
Downloads


Tomcat:
Documentation
Examples
Manager webapp
Host-manager webapp ## ----------- end text (exclude this line)

Comments

  • elecboyelecboy Posts: 1
    Hi @simonforsyth


    I almost finish the installation but I am having problems with the Starting OC, can you help me? Thanks!
  • Hi @elecboy - most problems are wrong version of the support software (tomcat / postgress), permissions / ownership of tomcat or openclinica folders, or settings in the datainfo.properties file. Check the PHP log files for clues.

    Unfortunately, I am away from my office and dev servers for a while, so that is the limit of my help at the moment.

    Last bit of help: I can't recommend a system that relies on outdated and unsupportd modules that have potential security issues. Particularly if you are storing confidential data.
  • mdelordmdelord Posts: 2
    Hello @simonforsyth.
    thank you for your instructions.
    I tried to install OC following your instructions, however I was not able to get through it.
    I could not even open tomcat home page : (


Sign In or Register to comment.