Installing on a pristine Tomcat
This section will depict how to deploy OpenKM in a pristine Apache Tomcat.
Preliminaries
Take a look at the installation of the whole system according to your Operating System:
- Installing on RedHat and CentOS (Manual) Installing on RedHat and CentOS (Manual)
- Installing on Ubuntu and Debian (Manual)
- Installing on Windows
Installing Tomcat
Download the latest Tomcat version from the Apache Tomcat page (Tomcat 7 or Tomcat 8 ) and extract it into the directory you want to install it.
Once Tomcat has been extracted, some modifications are necessary.
Copy libraries and configuration files
Copy the following required libraries to TOMCAT_HOME/lib. These files can be found in the Tomcat already configured by the OpenKM team, which can be downloaded from https://sourceforge.net/projects/openkm/files/common/
- unicode.ttf
- sigar directory
- mail-1.5.2.jar
- activemq-all-5.13.2.jar
- The driver, according to your database:
- MySQL: mysql-connector-java-5.1.12-bin.jar
- Oracle: ojdbc6-11.2.0.3.jar
- PostgreSQL: postgresql-9.1-902.jdbc4.jar
- SQL Server: sqljdbc4.jar
- Hypersonic: hsqldb.jar
- H2: h2-1.4.191.jar
Copy the following files to TOMCAT_HOME:
- OpenKM.cfg
- OpenKM.xml
- logback.xml
Modify configuration files
Modify the following files from TOMCAT_HOME/conf:
context.xml
Add the following configuration inside the Context section:
<!-- OpenKM resources -->
<ResourceLink global="jdbc/OpenKMDS" name="jdbc/OpenKMDS" type="javax.sql.DataSource"/>
<ResourceLink global="mail/OpenKM" name="mail/OpenKM" type="javax.mail.Session"/>
server.xml
Add the following configuration inside the GlobalNamingResources section:
- In the case of Tomcat 7
<Resource name="jdbc/OpenKMDS" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000" validationQuery="select 1"
username="openkm" password="*****" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/okmdb?autoReconnect=true&useUnicode=true&characterEncoding=UTF8"/>
<Resource name="mail/OpenKM" auth="Container" type="javax.mail.Session"
mail.smtp.host="localhost" mail.from="testing@openkm.com"/>
- In the case of Tomcat 8
<Resource name="jdbc/OpenKMDS" auth="Container" type="javax.sql.DataSource"
maxTotal="100" maxIdle="30" maxWaitMillis="10000" validationQuery="select 1"
username="openkm" password="*****" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/okmdb?autoReconnect=true&useUnicode=true&characterEncoding=UTF8"/>
<Resource name="mail/OpenKM" auth="Container" type="javax.mail.Session"
mail.smtp.host="localhost" mail.from="testing@openkm.com"/>
These two resources correspond to the ones to connect to the database and mail server. The corresponding parameters must be adapted to the different databases (this example is for a mysql database) and the corresponding mail server.
setenv.sh or setenv.bat
Depending on your Operating System, you have to create a file called setenv. sh in Linux or setenv.bat in Windows. This file should be placed in TOMCAT_HOME/bin. This is the context in the case of Linux:
JAVA_OPTS="$JAVA_OPTS -Xms256m -Xmx2048m -XX:+UseConcMarkSweepGC -Djava.awt.headless=true"
JAVA_OPTS="$JAVA_OPTS -Dlog4j.configuration=file://$CATALINA_HOME/conf/log4j.properties"
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dmail.mime.ignoreunknownencoding=true"
CATALINA_PID=$CATALINA_HOME/catalina.pid
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CATALINA_HOME/lib/sigar
And this is the content in the case of Windows:
set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx2048m -XX:+UseConcMarkSweepGC -Djava.awt.headless=true
set JAVA_OPTS=%JAVA_OPTS% -Dlog4j.configuration=file:///%CATALINA_HOME%/conf/log4j.properties
set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dmail.mime.ignoreunknownencoding=true
set PATH=%PATH%;%CATALINA_HOME%\lib\sigar
Installing OpenKM
With Tomcat stopped, copy the OpenKM.war file into TOMCAT_HOME \webapps
$ cp OpenKM.war $TOMCAT_HOME/webapps
Install third-party software
To do this, go to the section corresponding to your Operating System:
- Installing on RedHat and CentOS (Manual) Installing on RedHat and CentOS (Manual)
- Installing on Ubuntu and Debian (Manual)
- Installing on Windows
Start application
Check OpenKM.cfg parameters
$ vim TOMCAT_HOME/OpenKM.cfg
Your configuration file should contain something like this:
# OpenKM Hibernate configuration values
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
hibernate.hbm2ddl=create
# Logback configuration file
logback.config=logback.xml
Ensure hibernate.dialect=org.hibernate.dialect.MySQL5Dialect has enabled if your database is MySQL.
First-time application start:
$ start Tomcat
Use mTail Program - or equivalent - to watch the TOMCAT_HOME\log\catalina.log file.
When the application starts, you should see these log messages:
2015-07-04 18:28:10,680 [main] INFO org.apache.coyote.http11.Http11Protocol - Starting ProtocolHandler ["http-bio-0.0.0.0-8080"]
2015-07-04 18:28:10,688 [main] INFO org.apache.coyote.ajp.AjpProtocol - Starting ProtocolHandler ["ajp-bio-127.0.0.1-8009"]
2015-07-04 18:28:10,692 [main] INFO org.apache.catalina.startup.Catalina - Server startup in 41456 ms
The application will be accessible at http://YOUR_IP:8080/OpenKM using user: okmAdmin with password: admin. ( Do not forget to change it !). For more information: Manage users and roles.