In the follow sections, the “$” means the Linux command environment
Environment Configuration:
Java Environment -- JDK:
$java –version
Check the java environment should be java version “1.5.0_16” or other editions like 1.5.0_xx.
Make sure your java environment is based on version 5 1.5.0_xx
Set the environment:
$export JAVA_HOME=/usr/java/javapath
e.g.: /usr/java/jdk1.5.0_16
$export PATH=$PATH:$JAVA_HOME/bin/
Set the path of bin directory of Java
Tomcat:
Install
$unzip apache-tomcat-5.5.23
Extract the zip file of tomcat
$cp apache-tomcat-5.5.23 /opt/tomcat
Copy the directory to tomcat directory which is under the opt directory
*this opt directory is an example, you can put tomcat to any where
$export CATALINA_HOME=/opt/tomcat
If your tomcat directory is in another directory, change the “opt” to your path in the command.
$export PATH=$PATH:$CATALINA_HOME/bin
$export JAVA_OPTS="-server -XX:+UseParallelGC -Xmx768m -XX:MaxPermSize=160m -Djava.awt.headless=true"
Set the tomcat and Java memory cache. If your memory is big enough, you can change the number in “-XX:MaxPermSize=160m”. *160m160 mega bytes
** This is important step, otherwise your server will occur no enough memory to startup.
Tomcat Configuration:
Modify the tomcat_path/conf/server.xml file.
e.g: $nano /opt/tomcat/conf/server.xml
find the connector tag with port 8080
then add the URIEncoding="UTF-8" at the end
example:
<Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100" debug="0"
connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"/>
Maven Configuration:
Extract the maven tar file.
$tar xvf maven-2.0.6-bin.tar.gz
$cp maven-2.0.6-bin.tar.gz /opt/maven
Set environment:
$export MAVEN_HOME=/opt/maven
$export MAVEN_OPTS='-Xms256m -Xmx512m -XX:PermSize=64m -XX:MaxPermSize=128m'
You need to execute this command, otherwise, the error may be occurred when you are building the sakai.
Create local maven directory
$cd $HOME
$mkdir -p .m2/repository
$cd .m2
Create a file called setting.xml
Add the lines as following:
<settings xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>tomcat5x</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<appserver.id>tomcat5x</appserver.id>
<appserver.home>/opt/tomcat</appserver.home>
<maven.tomcat.home>/opt/tomcat</maven.tomcat.home>
<sakai.appserver.home>/opt/tomcat</sakai.appserver.home>
<surefire.reportFormat>plain</surefire.reportFormat>
<surefire.useFile>false</surefire.useFile>
</properties>
</profile>
</profiles>
</settings>
**The green lines mean you should use your full path of tomcat.
if you use the network proxy, you should add lines as follow. If not, ignore it.:
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>www.your.proxy.host</host>
<port>80</port>
<username>your_username</username>
<password>your_password</password>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
</proxies>
</settings>
Check maven installation:
$mvn --version
If it shows something about maven, success.
Sakai Installation:
Extract Sakai source code under the tomcat directory. The directory name is not very important.
e.g. /opt/tomcat/sakai
modify the Sakai configuration:
$nano path/component/component-api/component/src/config/org/sakaiproject/config/sakai.properties
The path means the full path to your sakai directory.
e.g.: $nano /opt/tomcat/sakai/component/component-api/component/src/config/org/sakaiproject/config/sakai.properties
in this file, you should change something as follow.
Database configuration:
# sakai.properties - the default edition
# This file is the default for providing all configuration and placeholder values for Sakai.
# All other sakai.properties files override these settings
# set the hibernate dialect (for shared datasource), HSQLDB by default, mySql and Oracle
hibernate.dialect=org.hibernate.dialect.HSQLDialect
#hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
#hibernate.dialect=org.hibernate.dialect.Oracle9iDialect
#hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
In this section, you need to choose the database type.
In our environment, the codes can be modified as follow:
# sakai.properties - the default edition
# This file is the default for providing all configuration and placeholder values for Sakai.
# All other sakai.properties files override these settings
# set the hibernate dialect (for shared datasource), HSQLDB by default, mySql and Oracle
#hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
#use MySQL database
[email protected]=jdbc:mysql://localhost:3306/sakai
#set database link to your database.
#sakai is your database name for Sakai project
# localhost:3306, this can be your database server address and port number
[email protected]=root
#set the username for using this database
#in this database, I use a username called root
[email protected]=xxxxxx
#this is the password for that username
#change “xxxxxx” to your password
[email protected]=mysql
#declare the sql service type mysql, you don’t need to change
[email protected]=com.mysql.jdbc.Driver
#set the JDBC Driver for program connecting the database
[email protected]=select 1 from DUAL
#verify the database by testing the query.
#the DUAL is built inside. Actually, this is a test process
[email protected]=TRANSACTION_READ_COMMITTED
#this also is a thing that built inside, you don’t need to change.
#hibernate.dialect=org.hibernate.dialect.Oracle9iDialect
#hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
Make sure automatically generate all objects:
# establish auto.ddl - on by default
auto.ddl=true
#auto.ddl=false
Email Configuration:
[email protected]=some.smtp.org
add this line into this file in anywhere.
# dns addresses used for incoming email
smtp.dns.1 = 255.255.255.1
smtp.dns.2 = 255.255.255.2
# change the smtp dns address to your smtp server
# SMTP port on which our SMTP server runs. Default is 25.
#Recommend running on 8025, and using a standard mailer on 25 to forward mail to Sakai.
smtp.port = 25
# flag to enable or disable our SMTP server for incoming email (true | false)
smtp.enabled = true
# email address used as the "from" address for any email sent by Worksite Setup tool or Site Info tool.
# Recipients may not receive notifications if this address isn't valid.
#setup.request=address@somedomain
You can find more information about modify this sakai.properties at /sakaipath/reference/docs/sakai.properties
*The sakaipath means the full path of your sakai directory.
MySQL Database Configuration:
Make sure your mysql is working.
$mysql --version
$mysql –u root –p
Enter password: ******
Type the command for creating the database.
mysql> create database sakai default character set utf8;
mysql> grant all on sakai.* to sakaiuser@'localhost' identified by 'sakaipassword';
mysql> grant all on sakai.* to sakaiuser@'127.0.0.1' identified by 'sakaipassword';
the sakaipassword needs to change to something you like.
The sakai project will automatically install the tables and objects into this database.
The database name should be the same as you defined in the sakai.properties
You also need to put a MySQL connector into tomcat/common/lib directory.
You can download it at here. Then click the download link of tar.gz file
Build and deploy the Sakai project
$cd /sakaipath/master
$mvn clean install
$cd ..
$ mvn clean install sakai:deploy -Dmaven.tomcat.home=/tomcatpath
Sakaipath is the full path of sakai directory
Tomcatpath is the full path of tomcat directory
e.g.:
$cd /opt/tomcat/sakai/master
$mvn clean install
$cd ..
$ mvn clean install sakai:deploy -Dmaven.tomcat.home=/opt/tomcat
/opt/tomcat is your tomcat path
You need to wait 10-60 minutes. It depends on your CPU and memory speed.
After all.
$cd /opt/tomcat/bin
$./startup.sh
Wait 10-20 minutes……
You will see the project by using link: http://localhost:8080/portal
Appendix:
Useful skills:
You can add these command into a script. (Example. Details should follow your environment)
export JAVA_HOME=/usr/java/javapath
export JAVA_OPTS="-server -XX:+UseParallelGC -Xmx768m -XX:MaxPermSize=160m -Djava.awt.headless=true"
export CATALINA_HOME=/opt/tomcat
export PATH=$PATH:$CATALINA_HOME/bin
export MAVEN_OPTS='-Xms256m -Xmx512m -XX:PermSize=64m -XX:MaxPermSize=128m'
export MAVEN_HOME=/opt/maven-2.0.6
export PATH=$PATH:$MAVEN_HOME/bin
Basic error information:
You may see the error when you are deploying this project.
Exception details:
The cache manager is not a live.
Solution:
Delete all the .war files under the tomcat/webapps directory
Then, rebuild the the sakai project using command: $ mvn clean install sakai:deploy -Dmaven.tomcat.home=/opt/tomcat