1、获取sakai源代码
可以通过svn下载最新代码,或者下载其发布的稳定版本。2.0 验证安装 Java 1.6
可通过在系统命令行中运行java -version
如果安装了java,会显示如下:
java version "1.6.0_24" Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326) Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
2.1 设置JAVA环境变量
JAVA必须设置一些相关的环境变量.对于UNIX操作系统,一种典型的配置方式 在如~/.bash_login
. 对于Windows, 通过图形界面设置
JAVA_HOME
设置 JAVA_HOME 指向安装JAVA的根目录并添加JAVA的/bin
目录到PATH环境变量.
如果变量JRE_HOME 已经设这,或者你想要使用一个特殊的JRE
Variable | Unix | Mac | Windows |
---|---|---|---|
JAVA_HOME | | | |
PATH | | | |
设置 JAVA_OPTS
默认的JAVA虚拟机对于sakai应用的大小是不够用的,所以为了运行sakai,一些java虚拟机的参数必须增大,其他的可能需要为了优化性能进行调整。 至少添加以下属性设置到你的JAVA_OPTS
环境变量.
我们建议在Tomcat的/bin
目录中setenv.sh
(Unix/Mac)或setenv.bat
(Windows)文件中设置这些配置. 通过Tomcat查看更多细节.
Unix/Mac:
export JAVA_OPTS='-server -Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m -XX:NewSize=192m -XX:MaxNewSize=384m -Djava.awt.headless=true -Dhttp.agent=Sakai -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Dsun.lang.ClassLoader.allowArraySyntax=true'
Windows:
set JAVA_OPTS=-server -Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m -XX:NewSize=192m -XX:MaxNewSize=384m -Djava.awt.headless=true -Dhttp.agent=Sakai -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Dsun.lang.ClassLoader.allowArraySyntax=true
额外需要的配置:
一些JSF工具 (聊天, portfolios, 测试与测验)不能在JAVA1.6中正确的编译. 工作区需要增加系统属性allowArraySyntax来避免数组反序列化的瓶颈。 (see SAK-17578 - Compiling with Java 1.6 breaks tools in Sakai - CLOSED ).
第二, Tomcat 5.5.27+ 实施严格的引号转义, a change in *.jsp handling that has yet to be addressed in certain tools such as portfolios (see SAK-15736 - NPE when trying to preview portfolios when running in tomcat 5.5.27 and websphere - CLOSED ).
最后, specify an HTTP user agent other than "Java/xxxxx" in order to resolve Google and other RSS feeds (see SAK-10159 - Unable to interpret RSS from Google News - CLOSED , SAK-13353 - Unable to render news from Times Higher Education Supplement (THES) - CLOSED and SAK-18044 - Add -Dhttp.agent=Sakai to demo startup scripts to resolve Google RSS feed issues - CLOSED ).
-Dsun.lang.ClassLoader.allowArraySyntax=true
-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false
-Dhttp.agent=Sakai
指定区域和语言
当启动sakai是你可以通过系统属性: -Duser.language and -Duser.region.来定义默认的 语言/区域。想了解支持的语言请查看发布日志或访问 i18N工作组空间.
-Duser.language=pt
-Duser.region=PT
指定一个HTTP 代理(可选)
In environments where local network policy or firewalls require use of an upstream HTTP proxy/cache, Sakai needs to be configured accordingly. Otherwise components or services which use HTTP requests, such as the BasicNewsService for RSS feeds in the News tool, cannot retrieve data from the target URLs. This can be fixed with the following JAVA_OPTS arguments:
-Dhttp.proxyHost=cache.some.domain
-Dhttp.proxyPort=8080
4.0安装Maven 2.2.1
Apache Maven 项目管理框架为sakai提供了一组构建标准、存储模型 、软件引擎用来管理和描述项目. 作为安装过程的一部分您将使用Maven作为一个构建工具来编译、测试和部署sakai到一个servlet容器。如Apache Tomcat。Maven 3.0目前不支持sakai2.8.
你可以在这里下载maven:http://maven.apache.org/download.html
Extract the distribution archive into your installation directory of choice, e.g. /opt/maven/apache-maven-2.2.1
. Confirm that you have installed the correct version of Maven and can start it by issuing mvn --version
from the terminal. At this point your environment is prepared to build and deploy the Sakai source code.
mvn --version
Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400) Java version: 1.6.0_20 Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home Default locale: en_US, platform encoding: MacRoman OS name: "mac os x" version: "10.6.3" arch: "x86_64" Family: "mac"
4.1 设置Maven环境变量
为最优Maven性能一些环境变量必须设置.对于Unix操作系统,一个典型的设置是在如 ~/.bash_login文件的启动文件中设置和导出 shell变量,而Mac用户可以在.bash_profile中
设置并导出环境变量
. 对于Windows,
:
Variable | Unix/Mac | Windows |
---|---|---|
MAVEN_HOME | | |
PATH | | |
Windows: append string to the end of the Path
system variable
MAVEN_OPTS
Maven 不在启动时读取JAVA_OPTS
,结果偶尔当构建sakai时出现“内存溢出” .为了确定在构建sakai工程时有充足的内存, 你需要增加一个像下方定义的MAVEN_OPTS环境变量。
对于Unix操作系统一种典型修改是在如 ~/.bash_login的启动文件中来设置和导出shell变量。Mac用户在 .bash_profile
. 对于WIndows可以通过图形化界面。
export MAVEN_OPTS='-Xms512m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=128m'
4.2 创建一个本地Maven 库
Unix/Mac
cd $HOME mkdir -p .m2/repository
Windows
mkdir %HOMEDRIVE%%HOMEPATH%\.M2\repository
在Windows中,默认的家路径是C:\Documents and Settings\yourusername
. Windows also establishes it through environment variables by combining your "home drive" location and your "home path" location, i.e. %HOMEDRIVE%%HOMEPATH%
. (The %
-sign is how Windows brackets environment variables).
4.3创建一个Maven settings.xml
文件
在你的
.m2
目录中创建一个名为
settings.xml的文件.
增加以下行,指定你的Tomcat的主目录的实际位置 (in this example
/opt/tomcat
).
不要在目录路径的结尾包含 / 或 \
Sakai不使用标准的appserver.home
所以你必须包含一个<sakai.appserver.home>
元素在你的 settings.xml
文件中. 对于Windows用户, sakai.appserver.home
的值必须为 C:\opt\tomcat
.
Unix/Mac | Windows | ||
---|---|---|---|
|
|
Optionally,你可以以一个环境变量来指定Tomcat的位置:
<
maven.tomcat.home
>${env.CATALINA_HOME}</
maven.tomcat.home
>
|
<proxies>
节点到
settings.xml
:
<
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
>
|
If you do not use a username or password for your proxy exclude the <username>
and <password>
elements. You only need the nonProxyHosts option
if you have a local maven repo that does not require the proxy to be accessed. Maven 2.0 does not support Microsoft's NTLN authentification scheme. If you connect to a proxy like ISA you will need to use a tool such as http://ntlmaps.sourceforge.net/ to proxy your traffic.
5.0 安装Tomcat 5.5.33
Tomcat 5.5: we recommend Tomcat 5.5.33 in order to avoid certain Tomcat security vulnerabilities present in earlier releases.Tomcat 6.0 / 7.0: Sakai 2.8 has not been tested in Tomcat 6.0 or 7.0 and will not run in either version of Tomcat without configuration changes. Adopters are advised to stay with the Tomcat 5.5. series.
JAVA_OPTS: running Sakai 2.x in Tomcat 5.5.27+ requires JAVA_OPTS
modifications (see below).
Sakai installations should always be accompanied by a fresh install of Tomcat. It provides a clean environment that simplifies troubleshooting if problems are encountered during the startup phase.
The Apache Tomcat servlet container provides an ideal environment for running Sakai as a web application. Tomcat implements both the Java Servlet and JavaServer Pages (JSP) specifications and can be run in standalone mode or in conjunction with a web application server such as the Apache HTTP server or JBoss. Sakai 2.8 works with the Tomcat 5.5 series.
Tomcat can be downloaded as a binary install from http://archive.apache.org/dist/tomcat/tomcat-5/
Choose the core distribution. Windows users have the option of downloading either a Windows Service Installer .exe
or a binary *.zip archive. We recommend the *.zip archive over the installer because configuration and log viewing are easier. You can later convert the .zip install into a service install by running /bin/service.bat
(see below for more details).
Unpack the Tomcat archive into your installation directory of choice, e.g. /opt/
. Unix/Mac users should create a symbolic link (e.g., ln -s apache-tomcat-5.5.33
) while Windows users should simply rename the base Tomcat directory to /tomcat
to simplify the path.
Tomcat pathnames
Windows users should ensure that the Tomcat path includes no spaces as this causes errors with JavaServer Faces (JSF) tools in Sakai.
Good: C:\opt\tomcat\, C:\sakaistuff\installs\tomcat\
Bad: C:\program files\tomcat\, C:\opt\apache tomcat 5.5.33\
Tomcat permissions
Unix/Mac users should make sure that they have write permissions to the Tomcat servlet container files and directories before proceeding or startup permission errors may occur.
Tomcat JDK 1.4 Compatibility Package
Do not download and install the JDK 1.4 Compatibility Package. Sakai 2.8 will not run should you install it.
5.1 Set Tomcat environment variables
By convention, the base Tomcat directory (e.g./usr/local/apache-tomcat-5.5.33
) is referred to as
$CATALINA_HOME
. As a convenience, you should create a
$CATALINA_HOME
environment variable. For UNIX operating systems one typically modifies a startup file like ~/.bash_login to set and export shell variables while Mac users typically set and export environment variables in
.bash_profile
. For Windows, go to
Start -> Control Panel -> System -> Advanced -> Environment Variables
and set your Tomcat environment variables via the GUI.
Set the CATALINA_HOME
environment variable to point to the base directory of your Tomcat installation and add the Tomcat /bin
directory to your PATH
variable:
Variable | Unix/Mac | Windows |
---|---|---|
CATALINA_HOME | | |
PATH | | |
Windows: append string to the end of the Path
system variable.