OLAT - Online Learning And Trainging是一套100% Java開發的免費web-based Open Source Learning Management System (LMS)。具備SCORM 1.2 compliance,對要求遵循國際標準的人來說應該是一個滿有吸引力的產品。目前支援的資料庫有
MySQL和
PostgreSQL及
HSQL,由於我的網站上目前已經裝有PostgreSQL,故我便選擇用PostgreSQL作為後端的資料庫。
由於我打算安裝到Production環境,故我參考了OLAT網站上的
安裝手冊,我的步驟大致如下
# Install the prerequisites
==>
JDK,
Apache,
Tomcat,
Ant, database(PostgreSQL)
大部分用Apache+Tomcat架站的人,應該都已經完成透過
mod_jk整合了。可能有些人會需要安裝Ant。
vi ~/.bash_profile
ANT_HOME=/usr/local/apache-ant-1.7.0
JAVA_HOME=/usr/java/latest
PATH=$PATH:$HOME/bin:$ANT_HOME/bin:$JAVA_HOME/bin
export PATH ANT_HOME JAVA_HOME
su - root
cd setup
wget http://apache.ntu.edu.tw/ant/binaries/apache-ant-1.7.0-bin.tar.gz
tar zxvf apache-ant-1.7.0-bin.tar.gz -C /usr/local
# modify JVM parameter
sed -i -e "2c\JAVA_OPTS=\"-server -XX:NewSize=64m -XX:MaxNewSize=64m -XX:SurvivorRatio=8 -XX:MaxPermSize=128m -Xss256k -Xms192m -Xmx192m -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true\"" /var/tomcat5/bin/setenv.sh
由於我的電腦記憶體只有384M,故我將Heap size設為一半,192M。
# create database olat and user olat
su - postgres
psql -c "CREATE GROUP olat;" template1
psql -c "CREATE USER olat WITH ENCRYPTED PASSWORD 'olat' VALID UNTIL 'infinity' CREATEDB;" template1
psql -c "ALTER GROUP olat ADD USER olat;" template1
psql -c "CREATE DATABASE olat WITH ENCODING 'UNICODE';" -U olat template1
psql -c "CREATE DATABASE testdb WITH ENCODING 'UNICODE';" -U olat template1
psql -c "ALTER USER olat NOCREATEDB;" template1
exit
exit
# Getting the sources
==>use browser to download
http://www.olat.org/downloads/stable/OLAT-5.1.3.zip
==>put OLAT-5.1.3.zip in /home/andowson/download
cd /home/andowson/download
unzip OLAT-5.1.3.zip
mv OLAT-5.1.3-PUBLIC-20070507 olat3
cd olat3
#這裡將目錄名字換為olat3以配合安裝手冊
# OLAT configuration
sed -e "s/\/usr\/local\/opt\/olat\/olat3/\/home\/andowson\/download\/olat3/g" \
-e "s/\/usr\/local\/opt\/olat\/olatdata/\/home\/andowson\/www\/olatdata/g" \
-e "1,$$s/myolat/andowson/g" \
-e "s/\/usr\/local\/opt\/tomcat5/\/var\/tomcat5/g" \
-e "44c\server.modjk.enabled=true" \
-e "75,97d" \
-e "1,$$s/#db/db/g" build.properties.default > build.properties
執行上面的指令就可以產生底下的結果了
################################################################
#
# Adapt these properties to your local installation.
#
#####
# Directory configurations
#####
# Absolute path for base.dir. Windows users: Use forward slashes also for windows paths!
base.dir=/home/andowson/download/olat3
# Absolute path for userdata.dir
userdata.dir=/home/andowson/www/olatdata
# Give this instance a unique id which serves as a
# namespace for addressable items within olat.
# Use a maximum of 10 characters.
instance.id=andowson
#####
# Tomcat installation path (e.g. CATALINA_HOME)
#####
tomcat.home=/var/tomcat5
#####
# Server and ports configuration
#####
# Use the fully qualified domainname that is configured for this server
server.domainname=www.andowson.com
# On a test system you usally use port 8080, on a productive system you
# would use port 80
server.port=80
# User a value of '0' if you do not want to enable SSL.
# If SSL is enabled, don't forget to uncomment the SSL section in the sample
# configuration file
# Eg. 8443, 443 (must not be empty, even if standard port 443 is used). Use 0 to disable SSL
server.port.ssl=0
# Tomcat context path: url under which olat is mounted
server.contextpath=/olat
# Set to 'true' when you want to use apache and mod_jk to conect the
# apache webserver with the tomcat servlet engine
server.modjk.enabled=true
#####
# Misc OLAT configurations
#####
# Systems default language
defaultlang=en
# Systems default charset (used while writing bytes to filesystem)
# e.g.: US-ASCII, ISO-8859-1, UTF-8
defaultcharset=ISO-8859-1
# Allow self registration
registration.enableSelfRegistration=true
# Send a notification mail when new users register
registration.enableNotificationEmail=false
registration.notificationEmail=newregistration@andowson.com
#####
# Email settings
#####
adminemail=webmaster@andowson.com
supportemail=support@andowson.com
smtp.host=smtp.andowson.com
# Folder component default values: upload size and quota in MB.
folder.maxulmb=50
folder.quotamb=50
#####
# Database configuration
#####
## example for PostgreSQL
db.dbms=hibernate.postgresql
db.host.name=localhost
db.host.port=5432
db.name=olat
db.user=olat
db.pass=olat
db.jdbc.jar=${base.dir}/webapp/WEB-INF/lib/postgresql-8.0-312.jdbc3.jar
db.jdbc.driver=org.postgresql.Driver
db.host=${db.host.name}:${db.host.port}
db.hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect
db.jdbc.url=jdbc:postgresql://${db.host}/${db.name}
db.showresults=false
## Next property is used by ant task "checkdb"
db.sqlquery=select 1
## optional configuration for a testdb for developers only using the junit tests with postgresql
db.test.name=testdb
db.test.user=olat
db.test.pass=olat
## do not encode & - this url gets written to a properties file
db.test.jdbc.url=jdbc:postgresql://${db.host}/${db.test.name}
#####
# Instant Messaging properties (optional)
#####
# If Instant Messaging is enabled but no instant messaging server is running
# the servlet container is not able to start up.
# You need Wildfire > 3.1.x from www.jivesoftware.org
instantMessaging.enable=false
instantMessaging.server.name=jabber.andowson.com
instantMessaging.generateTestUsers=false
instantMessaging.admin.username=admin
instantMessaging.admin.password=admin
instantMessaging.db.name=wildfire
instantMessaging.db.user=wildfire
instantMessaging.db.pass=wildfire
#####
# Shibboleth configuration parameters (optional)
#####
shibboleth.enable=false
shibboleth.providerId=YOUR_PROVIDERID
# Shibboleth WAYS sites configuration. May by a path relative to /webapp, an absolute path or an URI
shibboleth.sites.config=/WEB-INF/metadata.xml
# Shibboleth AAP configuration. May by a path relative to /webapp, an absolute path or an URI
# Leave empty if you do not havy any Attribute Acceptance Policy
shibboleth.aap.config=/WEB-INF/AAP.xml
# Shibboleth sites watchdog reload configuration. Set any time period in minutes.
shibboleth.sites.reloadmin=60
# Defines the name of the Shibboleth Attribute which uniquely identifies an authorized user.
shibboleth.defaultUID=defaultUID
shibboleth.keystore=${tomcat.home}/conf/keystore.p12
shibboleth.keystore.type=PKCS12
shibboleth.keystore.pass=changeit
shibboleth.key.pass=changeit
shibboleth.truststore=${tomcat.home}/conf/truststore.jks
shibboleth.truststore.type=JKS
shibboleth.truststore.pass=changeit
# enable (true or yes) sending the locale code in the AAI request with name in language.param specified.
language.enable=false
language.param=YOUR_PARAM_NAME
# Default authentication provider (login screen)
# OLAT (local logins) or Shib (when using Shibboleth)
default.auth.provider=OLAT
#
# Normally no need to change properties below this point
#
################################################################
# Debugging and test user generation
olat.debug=false
user.generateTestUsers=true
# Use caching for localization files. Use false only in a development
# environment since this leads to heavy file load operations!
localization.cache=true
# Database debugging
db.show_sql=false
#####
# Velocity engine properties. Use false only during development!
#####
velocity.cache.pages=true
velocity.input.encoding=UTF-8
velocity.output.encoding=UTF-8
#####
# MRTG configuration for monitoring (optional)
#####
mrtg.bin=/usr/bin/mrtg
monitoring.dir=${base.dir}/monitoring
mrtgbackup.dir=${log.dir}/mrtgbackup
mrtg.loginname=olat
mrtg.pwd=mypassword
#####
# Misc parameters
#####
forum.maxbodylength=4000
webxml.webdav.inbuffer=32768
webxml.webdav.outbuffer=32768
#####
# Directory definitions
#####
log.dir=${userdata.dir}/logs
folder.root=${userdata.dir}/bcroot
temp.dir=${base.dir}/temp
dist.dir=${base.dir}/dist
bin.dir=${base.dir}/bin
webapp.dir=${base.dir}/webapp
doc.dir=${webapp.dir}/static/doc
doc.api.dir=${doc.dir}/api
doc.api.windowtitle=OLAT API Documentation
source.dir=${webapp.dir}/WEB-INF/src
source.patches.dir=${webapp.dir}/WEB-INF/patchesSrc
tomcat.docbase=${webapp.dir}
#####
# Build properties
#####
build.version=5.1.3
build.buildnr.pattern=0000
build.buildnr.default=0001
build.info=build.info.txt
build.compiler=javac1.5
build.host=olat.unizh.ch
build.version.javafile=webapp/WEB-INF/src/org/olat/VersionImpl.java
build.dir=${webapp.dir}/WEB-INF/classes
failonerror.compile=true
failonerror.javadoc=false
failonerror.junit=false
failonerror.dbsetup=true
javadoc.header=<image src=\"http://www.olat.org/public/docroot/olatorg/images/logo.jpg\" width=\"90\" height=\"60\"/>
javadoc.footer=<center><b>1999-2006 (c) www.olat.org</b></center>
#####
# Properties files
#####
log.properties.file=log4j.properties
olatconfig.file=${base.dir}/webapp/WEB-INF/olat_config.xml
tomcat.server.xml.file=${base.dir}/conf/server.xml
tomcat.context.xml.file=${base.dir}/conf/context.xml
tomcat.web.xml.file=${webapp.dir}/WEB-INF/web.xml
#####
# JUnit properties
#####
junit.results.dir=${doc.dir}/test-results
junit.aggregation.dir=${doc.dir}/test-results
junit.doc.dir=${doc.dir}/test-results/html
#####
# Mail logger properties
#####
MailLogger.mailhost=smtp.unizh.ch
MailLogger.from=Ameisli (the ant) <developers@olat.unizh.ch>
MailLogger.failure.notify=true
MailLogger.success.notify=true
MailLogger.failure.to=developers@olat.unizh.ch
MailLogger.success.to=developers@olat.unizh.ch
MailLogger.failure.subject=Build Failure
MailLogger.success.subject=Build Success
#####
# Nightly build properties
#####
nightly.from=Ameisli (the ant) <developers@olat.unizh.ch>
nightly.tolist=developers@olat.unizh.ch
nightly.subject=Results of nightly build
nightly.mailhost=smtp.unizh.ch
#####
# CVS properties used by nightly build
#####
# Important: You must be in a directory with the same name as
# cvs.package to call the checkout target.
cvs.repository=:ext:nightly@cvs.olat.org:/usr/local/cvs
cvs.cvsrsh=ssh
cvs.package=olat3
cvs.target=${base.dir}/..
#####
# SVN properties used by nightly build
#####
svn.url=svn+ssh://nightly@cvs.olat.org/usr/local/server/subversion/repos/olat/trunk
svn.sandbox=${base.dir}/..
svn.dest.path=${svn.sandbox}/olat4
#####
# Fulltext Search properties
#####
generate.index.at.startup=true
restart.window.start=0
restart.window.end=24
紅色的字就是我修改的地方,另外一個值得注意的就是我刪掉了MySQL設定的區塊(原來的75-97行)
接著執行
ant config-all
su - root
cp /home/andowson/download/olat3/webapp/WEB-INF/lib/xercesImpl.jar /var/tomcat5/common/endorsed
cp /home/andowson/download/olat3/webapp/WEB-INF/lib/xml.apis.jar /var/tomcat5/common/endorsed
cp /home/andowson/download/olat3/webapp/WEB-INF/lib/xalan.jar /var/tomcat5/common/endorsed
exit
ant build
ant dbsetup_postgreSQL
cp -rf /home/andowson/download/olat3/webapp /home/andowson/www/olat
cp -rf /home/andowson/download/olat3/htdocs/* /home/andowson/www/olat
cd /home/andowson/www/olat/WEB-INF
sed -i -e "13c\ <\!-- default session timeout -->" web.xml
rm -rf /home/andowson/www/olat/WEB-INF/src
rm -rf /home/andowson/www/olat/WEB-INF/patchesSrc
chown -R andowson:tomcat /home/andowson/www/olat
chown -R andowson:tomcat /home/andowson/www/olatdata
chmod 775 /home/andowson/www/olat/static
在/home/andowson/www/olat/WEB-INF/classes下新增一個hibernate.properties檔案
hibernate.connection.driver_class = org.postgresql.Driver
hibernate.connection.url = jdbc:postgresql://localhost/olat
hibernate.connection.username = olat
hibernate.connection.password = olat
hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
由於/etc/httpd/conf/workers.properties應該在Apache+Tomcat整合時已做過,故不去動它。
我們只需要再新增一個JkMount讓Apache把/olat導給Tomcat處理:
vi /etc/httpd/conf.d/mod_jk.conf
JkRequestLogFormat "%w %V %T %r"
JkMount /olat/* loadbalancer
重新啟動Tomcat
service tomcat restart
重新啟動Apache
service httpd restart
開啟瀏覽器存取http://www.andowson.com/olat
將會導引至http://www.andowson.com/olat/dmz/
輸入帳號administrator及密碼olat即可登入(建議先修改密碼再往下做別的事)
接下來就是中文化的工作了。