OpenKM在在社群版支援多國語言切換、面版管理、檔案上傳與下載、版本控管、文件分類管理、文件預覽、限制文件檔案下載、標籤雲功能、進階搜尋、個人文件管理、多檔管理支援、WebDAV連線存取、OCR支援、防毒支援、使用者帳戶管理、行動裝置支援、OpenOffice整合支援(Addon)、Microsoft Office外掛整合支援(Addins,其中社群版僅支援Word與Outlook)等等。
以下說明在Linux 安裝Open KM的步驟:
1. 安裝環境說明:
Linux Red Hat 7 + TOMCAT 7.3 + PostgreSQL 9
2. 下載OpenKM的安裝檔, 有二種安裝檔案可選擇:
A. openkm-6.3.0-community-war.zip, 直接下載war檔, deploy在已存在的tomcat之上
B. Openkm-6.3.0-community-linux-x64-installer.run, 完整安裝檔適合没有tomcat的環境,
今天因為已安裝了tomcat7 , 所以就用方法A.
3. 解壓縮ZIP檔, 將WAR檔上傳放置在$CATALINA_HOME/webapps,
4. tomcat本身並没有log4j.jar, 所以必須至Aapache 下載log4j.jar並放在$CATALINA_HOME/lib下
其它應在%CATALINA_HOME/lib加入的JAR檔如下圖
log4j.rootLogger=INFO, CONSOLE, CATALINA
# Define all the appenders
log4j.appender.CATALINA=org.apache.log4j.DailyRollingFileAppender
log4j.appender.CATALINA.File=${catalina.base}/logs/catalina.log
log4j.appender.CATALINA.Append=true
log4j.appender.CATALINA.Encoding=UTF-8
# Roll-over the log once per day
log4j.appender.CATALINA.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.CATALINA.layout = org.apache.log4j.PatternLayout
log4j.appender.CATALINA.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.LOCALHOST=org.apache.log4j.DailyRollingFileAppender
log4j.appender.LOCALHOST.File=${catalina.base}/logs/localhost.log
log4j.appender.LOCALHOST.Append=true
log4j.appender.LOCALHOST.Encoding=UTF-8
log4j.appender.LOCALHOST.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.LOCALHOST.layout = org.apache.log4j.PatternLayout
log4j.appender.LOCALHOST.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.MANAGER=org.apache.log4j.DailyRollingFileAppender
log4j.appender.MANAGER.File=${catalina.base}/logs/manager.log
log4j.appender.MANAGER.Append=true
log4j.appender.MANAGER.Encoding=UTF-8
log4j.appender.MANAGER.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.MANAGER.layout = org.apache.log4j.PatternLayout
log4j.appender.MANAGER.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.HOST-MANAGER=org.apache.log4j.DailyRollingFileAppender
log4j.appender.HOST-MANAGER.File=${catalina.base}/logs/host-manager.log
log4j.appender.HOST-MANAGER.Append=true
log4j.appender.HOST-MANAGER.Encoding=UTF-8
log4j.appender.HOST-MANAGER.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.HOST-MANAGER.layout = org.apache.log4j.PatternLayout
log4j.appender.HOST-MANAGER.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Encoding=UTF-8
log4j.appender.CONSOLE.layout = org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
# Configure which loggers log to which appenders
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=INFO, LOCALHOST
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]=INFO, MANAGER
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager]=INFO, HOST-MANAGER
# OpenKM
log4j.logger.org.hibernate=WARN
log4j.logger.org.jbpm=WARN
log4j.logger.com.openkm=INFO
5. 在$CATALINA_HOME下建立三檔案 : OpenKM.xml, PropertyGroups.xml, OpenKM.cfg
OpenKM.xml 內容如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.1.xsd">
<!-- Security configuration -->
<security:authentication-manager alias="authenticationManager">
<security:authentication-provider>
<security:password-encoder hash="md5"/>
<security:jdbc-user-service
data-source-ref="dataSource"
users-by-username-query="select usr_id, usr_password, 1 from OKM_USER where usr_id=? and usr_active='T'"
authorities-by-username-query="select ur_user, ur_role from OKM_USER_ROLE where ur_user=?"/>
</security:authentication-provider>
</security:authentication-manager>
</beans:beans>
PropertyGroups.xml內容如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.0//EN"
"http://www.openkm.com/dtd/property-groups-2.0.dtd">
<property-groups>
<property-group label="Consulting" name="okg:consulting">
<input label="Name" type="text" name="okp:consulting.name"/>
<input label="Date" type="date" name="okp:consulting.date" />
<checkbox label="Important" name="okp:consulting.important"/>
<textarea label="Comment" name="okp:consulting.comment"/>
</property-group>
<property-group label="Technology" name="okg:technology">
<select label="Type" name="okp:technology.type" type="multiple">
<option label="Alfa" value="t1"/>
<option label="Beta" value="t2" />
<option label="Omega" value="t3" />
</select>
<select label="Language" name="okp:technology.language" type="simple">
<option label="Java" value="java"/>
<option label="Python" value="python"/>
<option label="PHP" value="php" />
</select>
<input label="Comment" name="okp:technology.comment"/>
<textarea label="Description" name="okp:technology.description"/>
<input label="Link" type="link" name="okp:technology.link"/>
</property-group>
</property-groups>
OpenKM.cfg 內容如下:
# OpenKM Hibernate configuration values
#hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.hbm2ddl=none
# Initial configuration - Linux
system.imagemagick.convert=/usr/bin/convert
system.openoffice.path=/usr/lib/libreoffice
system.swftools.pdf2swf=/opt/openkm/bin/pdf2swf -f -T 9 -t -s storeallcharacters ${fileIn} -o ${fileOut}
# Initial configuration - Windows
#system.imagemagick.convert=C:/openkm/bin/convert.exe
#system.openoffice.path=C:/Program Files (x86)/OpenOffice 4
#system.swftools.pdf2swf=C:/openkm/bin/pdf2swf.exe -f -T 9 -t -s storeallcharacters ${fileIn} -o ${fileOut}
每個檔案都有的作用, 之後設定都會修改到它,
6. 下載JDBC Driver for PostgreSQL , 並將jar檔放置至$CATALINA_HOME/lib
7. 加入連結PostgreSQL的Datasource
A. 開啟$CATALINA_HOME/conf/server.xml 在<GlobalNamingResources>加入紅字部份:
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
<Resource name="jdbc/OpenKMDS" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000" validationQuery="select 1"
username="openKM" password="XXXXX" driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://XXXXXX:5432/okmdb"/>
<Resource type="javax.mail.Session" auth="Container"
name="mail/OpenKM" mail.from="testing@openkm.com" mail.smtp.host="localhost"/>
</GlobalNamingResources>
記得將XXX的部份改成適當值
B. 修改$CATALINA_HOME/conf/context.xml , 加入以下兩行
<ResourceLink type="javax.sql.DataSource" name="jdbc/OpenKMDS" global="jdbc/OpenKMDS"/>
<ResourceLink type="javax.mail.Session" name="mail/OpenKM" global="mail/OpenKM"/>
8. 建立資料庫及使用者, 這就不多說了, 在PostgreSQL建立一個openKm的使用者及名稱為okmdb的資料庫.
9. 在開啟tomcat之前, 記得修改$CATALINA_HOME/OpenKM.cfg加入這兩行
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.hbm2ddl=create //create表示要新增資料庫, 當Deploy完成後, 便會自動改成none
10. 開啟 tomcat , 進入OpenKM的登入畫面, 但預設只有兩種語言,記得去下載語言包 , 選擇要安裝的語言下載, 打開資料庫工具用執行SQL就行了.