InstallationA


This guide walks you through installing OpenOLAT on a local GNU/Linux or similar system.

Create a user for OpenOLAT

The username is openolat in this guide with home directory in /home/openolat

Download OpenOLAT, JRE and tomcat

Download JRE 1.7, tomcat-7 and OpenOLAT-9.0.x war file. Create a directory downloads and keep the downloaded files there:

openolat~$ ls -l downloads/
total 136652
-rw-r--r-- 1 openolat openolat  7843733 Sep 18 10:34 apache-tomcat-7.0.40.tar.gz
-rw-r--r-- 1 openolat openolat 46808550 Sep 18 10:34 jre-7u40-linux-x64.tar.gz
-rw-r--r-- 1 openolat openolat 85277009 Sep 10 21:42 openolat_903.war
Note that you do not need a JDK to run OpenOLAT.

Prepare home directory

In the home directory:

zcat downloads/apache-tomcat-7.0.40.tar.gz | tar xvf -
ln -s apache-tomcat-7.0.40 tomcat
 
zcat downloads/jre-7u40-linux-x64.tar.gz | tar xvf -
ln -s jre1.7.0_40/ jre
 
mkdir openolat-9.0.3
unzip -d openolat-9.0.3/ downloads/openolat_903.war
ln -s openolat-9.0.3 webapp

Set up Tomcat in home directory

mkdir bin conf lib run logs

Link the following files

ln -s ../tomcat/conf/web.xml conf/
ln -s ../tomcat/bin/catalina.sh bin/

Create handy links

ln -s tomcat/bin/startup.sh start
ln -s tomcat/bin/shutdown.sh stop

Create the file bin/setenv.sh containing

CATALINA_BASE=.
JRE_HOME=./jre
CATALINA_PID=./run/openolat.pid
CATALINA_TMPDIR=/tmp/openolat
mkdir -p $CATALINA_TMPDIR
 
CATALINA_OPTS="                              \
-Xss256k -Xmx512m -Xms512m -XX:PermSize=192m \
-Duser.name=openolat                         \
-Duser.timezone=Europe/Zurich                \
-Dspring.profiles.active=myprofile           \
-Djava.awt.headless=true                     \
-Djava.net.preferIPv4Stack=true              \
-Djava.endorsed.dirs=./common/endorsed       \
-XX:+HeapDumpOnOutOfMemoryError              \
-XX:HeapDumpPath=.                           \
"

Tomcat scripts will parse this file at startup.

Create the file conf/server.xml

<?xml version='1.0' encoding='utf-8'?>
<Server port="8085" shutdown="SHUTDOWN">
  <Service name="Catalina">
    <Connector port="8088" protocol="HTTP/1.1" />
    <Engine name="Catalina" defaultHost="localhost">
      <Host name="localhost"  appBase="webapps" />
    </Engine>
  </Service>
</Server>

Make sure the chosen ports (8085 and 8085 in this example) are available.

Set the environment variable CATALINA_HOME, for example by appending the following to your .bashrc

export CATALINA_HOME=~/tomcat

Test tomcat

./start

Shoult output something like this:

Using CATALINA_BASE:   .
Using CATALINA_HOME:   /home/openolat/tomcat
Using CATALINA_TMPDIR: /tmp/openolat
Using JRE_HOME:        ./jre
Using CLASSPATH:    /home/openolat/tomcat/bin/bootstrap.jar:/home/openolat/tomcat/bin/tomcat-juli.jar
Using CATALINA_PID:    ./run/openolat.pid

Check whether these values make sense and stop tomcat.

./stop

Set up mysql database and user

Do the following as mysql root user

create database oodb character set utf8 collate utf8_unicode_ci;
grant all privileges on oodb.* to oodbu@localhost identified by 'oodbpasswd';

Test the mysql account as openolat user

mysql oodb -u oodbu -poodbpasswd
You should get the mysql cli prompt. Exit.

Optionally create a file named .my.cnf containing

[client]
database=oodb
user=oodbu
password=oodbpasswd
then you can access the database by just typing mysql.

Create the OpenOLAT database schema

cd webapp/WEB-INF/classes/database/mysql/
mysql oodb -u oodbu -poodbpasswd < setupDatabase.sql

Create OpenOLAT configuration

Create the file lib/olat.local.properties

db.source=jndi
db.jndi=java:comp/env/jdbc/OpenOLATDS
installation.dir=/home/openolat
server.contextpath=/openolat
server.domainname=localhost
server.port=8080
server.port.ssl=0
smtp.host=disabled
tomcat.id=1
userdata.dir=/home/openolat/olatdata
log.dir=/home/openolat/logs

Create the context file for the OpenOLAT Application

mkdir -p conf/Catalina/localhost/
and create the file mkdir -p conf/Catalina/localhost/openolat.xml containing
<?xml version="1.0" encoding="UTF-8" ?>
<Context path="/openolat" docBase="/home/openolat/webapp" debug="0" reloadable="false" allowLinking="true">
  <Resource name="jdbc/OpenOLATDS" auth="Container" type="javax.sql.DataSource"
     maxActive="32" maxIdle="8" maxWait="60000"
     username="oodbu" password="oodbpasswd"
     driverClassName="com.mysql.jdbc.Driver"
     validationQuery="SELECT 1" 
     validationQueryTimeout="-1" 
     testOnBorrow="true" 
     testOnReturn="false"
     url="jdbc:mysql://localhost:3306/oodb?useUnicode=true&characterEncoding=UTF-8&cachePrepStmts=true&cacheCallableStmts=true&autoReconnectForPools=true"/>
</Context>
Make sure the values of username, password and the "localhost:3306/oodb" part in the url value are the ones of your mysql account for OpenOLAT.

Configure log4j

Create the file lib/log4l.xml containing

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false" threshold="all">
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
  <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%d [%t] %-5p %c{1} %x - %m%n"/>
  </layout>
</appender>
<appender name="DebugLog" class="org.apache.log4j.DailyRollingFileAppender">
   <param name="File" value="/home/openolat/logs/olat.debug.log"/>
   <param name="DatePattern" value="'.'yyyy-MM-dd"/>
   <layout class="org.apache.log4j.PatternLayout">
     <param name="ConversionPattern" value="%d [%t] %-5p %c{1} %x - %m%n"/>
   </layout>
 </appender>
 <appender name="syslog" class="org.apache.log4j.DailyRollingFileAppender">
   <param name="File" value="/home/openolat/logs/olat.log"/>
   <param name="DatePattern" value="'.'yyyy-MM-dd"/>
   <layout class="org.apache.log4j.PatternLayout">
     <param name="ConversionPattern" value="%d [%t] %-5p %c{1} %x - %m%n"/>
   </layout>
 </appender>
 <logger name="org.olat"> <level value="INFO"/> </logger>
 <logger name="org.olat.basesecurity.AuthHelper"> <level value="ERROR"/> </logger>
 <logger name="org.apache.commons.httpclient"> <level value="WARN"/> </logger>
 <logger name="org.olat.core.commons.taskExecutor.ThreadPoolTaskExecutor"> <level value="ERROR"/> </logger>
 <logger name="org.apache.pdfbox.filter.FlateFilter"> <level value="FATAL" /> </logger>
 <logger name="org.apache"> <level value="ERROR"/> </logger>
 <logger name="org.hibernate"> <level value="ERROR"/> </logger>
 <logger name="org.springframework"> <level value="ERROR"/> </logger>
 <logger name="org.hibernate.event.def.AbstractFlushingEventListener"> <level value="FATAL"/> </logger>
 <logger name="net.sf.hibernate"> <level value="WARN"/> </logger>
 <logger name="org.jboss.cache"> <level value="WARN" /> </logger>
 <logger name="org.hibernate.cache"> <level value="WARN" /> </logger>
 <root> <level value="INFO" /> <appender-ref ref="syslog"/> </root>
</log4j:configuration> 

Delete the log4j.xml file packaged with OpenOLAT

rm webapp/WEB-INF/classes/log4j.xml

Start OpenOLAT

./start

The file log/catalina.out should say

INFO: Deploying configuration descriptor /home/openolat/conf/Catalina/localhost/openolat.xml
near the end and the last line should be like
INFO: Server startup in 16310 ms 

Try OpenOLAT

point your browser to

http://localhost:8088/openolat
username: administrator
password: openolat