Installing on a pristine Tomcat
This section will depict how to deploy OpenKM in a pristine Apache Tomcat.
Preliminaries
Section titled “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
Section titled “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
Section titled “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
Section titled “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.pidexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CATALINA_HOME/lib/sigarAnd this is the content in the case of Windows:
set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx2048m -XX:+UseConcMarkSweepGC -Djava.awt.headless=trueset JAVA_OPTS=%JAVA_OPTS% -Dlog4j.configuration=file:///%CATALINA_HOME%/conf/log4j.propertiesset JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dmail.mime.ignoreunknownencoding=trueset PATH=%PATH%;%CATALINA_HOME%\lib\sigarInstalling OpenKM
Section titled “Installing OpenKM”With Tomcat stopped, copy the OpenKM.war file into TOMCAT_HOME \webapps
$ cp OpenKM.war $TOMCAT_HOME/webappsInstall third-party software
Section titled “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
Section titled “ Start application”Check OpenKM.cfg parameters
Section titled “Check OpenKM.cfg parameters”$ vim TOMCAT_HOME/OpenKM.cfgYour configuration file should contain something like this:
# OpenKM Hibernate configuration valueshibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialecthibernate.hbm2ddl=create
# Logback configuration filelogback.config=logback.xmlFirst-time application start:
$ start TomcatWhen 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 msThe 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.