OpenKM 5.x with MySQL

Install OpenKMĀ 

Install openkm in /opt directory

Database Setup

DROP DATABASE IF EXISTS okm_repo; DROP DATABASE IF EXISTS okm_app;
CREATE DATABASE okm_repo DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;
CREATE DATABASE okm_app DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;
CREATE USER 'openkm'@'localhost' IDENTIFIED BY 'h3ll0$';
GRANT ALL ON okm_repo.* TO 'openkm'@'localhost' WITH GRANT OPTION;
GRANT ALL ON okm_app.* TO 'openkm'@'localhost' WITH GRANT OPTION;

Configure Datasource

Edit the fileĀ $JBOSS_HOME/server/default/deploy/openkm-ds.xml as follow:

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource> 
	<jndi-name>OpenKMDS</jndi-name> 
	<connection-url>jdbc:mysql://localhost:3306/okm_app?autoReconnect=true</connection-url> 
	<driver-class>com.mysql.jdbc.Driver</driver-class> 
	<user-name>openkm</user-name> 
	<password>h3ll0$</password> 
	<min-pool-size>5</min-pool-size> 
	<max-pool-size>20</max-pool-size> 
	<idle-timeout-minutes>28680</idle-timeout-minutes> 
	<exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
	<valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>
	<metadata> <type-mapping>mySQL</type-mapping></metadata> 
</local-tx-datasource>
</datasources>

Configure repository.xml

Replace the $JBOSS_HOME/repository.xml with this one.

I changed the <PersistenceManager> block inside both <Workspace> and <Versioning> blocks as follows:

<Workspace name="${wsp.name}">
....
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager">
  <param name="driver" value="com.mysql.jdbc.Driver"/> 
  <param name="url" value="jdbc:mysql://localhost:3306/okm_repo?autoReconnect=true"/> <param name="schema" value="mysql"/>
  <param name="user" value="openkm"/>
  <param name="password" value="h3ll0$"/>
  <param name="schemaObjectPrefix" value="${wsp.name}_"/>
  <param name="externalBLOBs" value="false"/> 
</PersistenceManager>
....
</Workspace>
<Versioning rootPath="${rep.home}/version">
...
<PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager">
  <param name="driver" value="com.mysql.jdbc.Driver"/>
  <param name="url" value="jdbc:mysql://localhost:3306/okm_repo? autoReconnect=true"/>
  <param name="schema" value="mysql"/> 
  <param name="user" value="openkm"/> 
  <param name="password" value="h3ll0$"/> 
  <param name="schemaObjectPrefix" value="version_"/> 
  <param name="externalBLOBs" value="false"/>
</PersistenceManager>
...

Setup OpenKM.cfg

Edit the $JBOSS_HOME/OpenKM.cfg as follows:

hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.hbm2ddl=create

Run OpenKM

Next you can run OpenKM with

$JBOSS_HOME/bin/run.sh

To listen on all network interfaces run with the -b 0.0.0.0 option.
Once you run the server for the first time remember to change the hibernate.hbm2ddl option to none in the OpenKM.cfg. This will avoid to recreate the tables each time you run the server.

Enjoy!

This entry was posted in linux and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">