sakai配置(英文版)

来源:互联网 发布:淘宝开网店技巧 编辑:程序博客网 时间:2024/04/28 22:16
 Information

This is a walkthrough for setting up a Sakai development environment on a laptop or desktop. These instructions will also work for setting up a development server though I suggest slightly beefier settings for memory. This is currently tailored for Sakai 2.2.x. Once you have a Sakai development environment setup you should be able to program your own Sakai tools or modify existing tools.

Notes for windows users

  • change the "/" to "/" for all directory paths except those specified in the maven build.properties file
  • add the drive letter (C:) to your paths
  • use %VARIABLE% instead of $VARIABLE with environment variables
  • set your environment variables in Control Panel -> System -> Advanced -> Environment Variables

 

All of sakai and related programs should be installed in an opt directory which you will need full write access to, put this directory anywhere you want, this document will assume you have placed it in your root directory


1.     Install/Verify you have Java 1.5

1.       To check: Run java -version on the command line

2.       If not correct, download the J2SE SDK from:

§         http://java.sun.com/j2se/1.5.0/download.jsp

§         Mac OS X users will have Java 1.5 by default

3.       Install it (the SDK) to /opt/java

§         Note: Install the JRE to a different directory (probably the default, especially under windows)

§          or you will have problems

4.       Set environment variable: JAVA_HOME=/opt/java

§         Mac users: JAVA_HOME=/Library/Java/Home

§         Windows users default: JAVA_HOME=C:/j2sdk1.5.0_xx (where "xx" is the minor version - for example "j2sdk1.5.0_11")

5.       Add $JAVA_HOME/bin to PATH

6.       Set JAVA_OPTS for tomcat in the tomcat/bin/setenv file (see Install Tomcat 5.5)

7.      JAVA_OPTS='-server -XX:+UseParallelGC -Xmx768m -XX:MaxPermSize=128m -Djava.awt.headless=true'

§         These settings are for developers

§         More info on JVM tuning: Sakai 2.2 developer JVM tuning

2.     Install/Verify you have MySQL 4.1

o        MySQL - http://www.mysql.com

§         Some have reported that MySQL 5.0.x works just fine as well. If you already have this version, there's likely no point in downgrading to 4.1.*.

2.       To check: Run mysql --help on the command line

3.       If not, download MySQL from:

§         http://dev.mysql.com/downloads/

4.       Custom install to /opt/mysql (options vary slightly based on operating system)

§         Linux users should install MySQL using a package or binaries if possible

2.     Choose standard configuration

3.     Install as a windows service (Windows only)

4.     Launch automatically (recommended)

§         If you choose not to do this, make sure that you startup MySQL before you try to run Sakai

5.     Include the bin directory in Path

6.     Don't use an anonymous account

7.     Set your root password to "mysqlpwd1"

3.     Setup Sakai DB (schema) and user

0.       Create the sakai database and sakai user (password=ironchef)

1.       Run the following from a command line prompt:

2.      mysql -uroot -pmysqlpwd1

§         Note: You can also do the following if you prefer to be prompted for the password: mysql -uroot -p

3.       Then run these commands from the mysql prompt (one command per line):

4.      create database sakai default character set utf8;

5.      grant all privileges on sakai.* to 'sakai'@'localhost' identified by 'ironchef';

6.      flush privileges;

7.      quit

8.       [Optional] Download and install mysql query browser

0.       http://dev.mysql.com/downloads/query-browser/1.1.html

1.       You do not have to do anything with query browser now

4.     Download and setup Maven 1.0.2 stable package

o        Maven - http://maven.apache.org/

1.       Download Maven 1.x - http://maven.apache.org/maven-1.x/start/download.html

§         Note - although Maven 2.0 is out and stable, it does not currently work with Sakai.

2.       Extract to /opt (should create maven-1.0.2 folder)

3.       Set environment variable: MAVEN_HOME=/opt/maven-1.0.2

4.       Add $MAVEN_HOME/bin to PATH/

5.       Set the MAVEN_OPTS environment variable

6.      MAVEN_OPTS='-Xms256m -Xmx512m -XX:PermSize=64m -XX:MaxPermSize=128m'

5.       Install/Verify you have Subversion

o        Subversion - http://subversion.tigris.org/

1.       To check: Run svn --version on the command line

§         http://subversion.tigris.org/project_packages.html

§         Get the subversion binaries and not the source, if possible

§         If there are no binaries for your platform, get the source and use the configuration

§         options --with-ssl and --with-libs

2.       Extract to /opt (should create subversion-1.2.3)

§         Windows users will want to rename the extracted directory

§         Unix users will probably want to use a package for their flavor

3.       Set environment variable: SUBVERSION_HOME=/opt/subversion-1.2.3

4.       Add $SUBVERSION_HOME/bin to PATH

6.     Download and setup tomcat 5.5.17+ (stable only)

o        Apache Tomcat - http://tomcat.apache.org/

1.       Note: Always do a fresh install of Tomcat

2.       Download tomcat 5.5 - http://tomcat.apache.org/download-55.cgi

§         Windows users should get the zip file instead of installing a service
It makes viewing the tomcat logs easier and it is easier to configure

3.       Extract to /opt (symlink the apache-tomcat-5.5.x directory to tomcat after extracting)

§         Windows users should just rename the directory since they cannot symlink

4.       Download the java 1.4.2 compat patch (compat.zip)

5.       Extract the files to the same location as tomcat itself

6.       Modify conf/server.xml for international character support

0.       Add URIEncoding="UTF-8" to the Connector element

§         <Connector port="8080" URIEncoding="UTF-8" ...

7.       Set environment variable: CATALINA_HOME=/opt/tomcat

8.       Add $CATALINA_HOME/bin to PATH

9.       Setup the SETENV file in the tomcat/bin directory with JAVA_OPTS (from Install Java 1.5)

0.       Mac/Linux: Create a file called setenv.sh with the following:

export JAVA_OPTS="-server -XX:+UseParallelGC -Xmx768m -XX:MaxPermSize=160m -Djava.awt.headless=true"

1.       Windows(PC): Create a file called setenv.bat with the following:

set JAVA_OPTS=-server -XX:+UseParallelGC -Xmx768m -XX:MaxPermSize=160m -Djava.awt.headless=true

7.     Download and setup MySQL Connector/J stable

o        Mysql Connector J - http://www.mysql.com/products/connector/j/

1.       Download connector for your version of MySQL

0.       If running mySQL 4.1
Download version 3.1.12+ from
http://dev.mysql.com/downloads/connector/j/3.1.html

1.       If running MySQL 5.0.x
Download version 5.0.4+ from
http://dev.mysql.com/downloads/connector/j/5.0.html

2.       Extract the file to /opt

3.       Copy mysql-connector-java-<version>-bin.jar to $CATALINA_HOME/common/lib

4.       Delete the extracted folder

8.     Use Subversion to download sakai 2.2.x cafe branch

0.       Change to the /opt directory

1.       svn checkout https://source.sakaiproject.org/svn/cafe/branches/2-2-x/

0.       If you want a version other than this one, browse the tags at

1.        https://source.sakaiproject.org/svn/cafe/

2.       subversion will create a "2-2-x" directory for you,
you can use any directory name you like, just add a name after the checkout location:
svn checkout
https://source.sakaiproject.org/svn/cafe/branches/2-2-x/ cafe-2.2.x

2.       Checkout will take about 5-10 minutes

3.       The directory created by subversion will be referred to as <sakai-src> directory

9.     Setup sakai.properties file

0.       Create sakai directory in $CATALINA_HOME

§         $CATALINA_HOME should be /opt/tomcat if you have been following these instructions

§         Note: There were previously two configuration files, sakai.properties and placeholder.properties. These have now been combined into sakai.properties. You can attempt to manually combine the two files from a previous version,

§          but it's better to start with the sample included with the sakai source in the reference directory.

1.       Copy sakai.properties from <sakai-src>/reference/docs to $CATALINA_HOME/sakai

§         Note: This file may not be in your checkout if you have acquired

§          one of the older versions of cafe - you can fetch it manually from

§          here https://source.sakaiproject.org/svn/reference/trunk/docs/sakai.properties .
Make sure you get the sakai.properties for the version of Sakai you are using (e.g. Sakai 2.2.x):
http://source.sakaiproject.org/svn/reference/branches/sakai_2-2-x/docs/sakai.properties

2.       Edit the sakai.properties file for a MySQL dev environment.

3.       Starting at the section # DATABASE CONFIGURATION:

0.       Set BaseDataSource username

1.       Set username@javax.sql.BaseDataSource=sakai

1.       Set BaseDataSource password

0.       Set password@javax.sql.BaseDataSource=ironchef

2.       Find the section: ## HSQLDB settings and comment out 7+ lines in it

3.            ## HSQLDB settings - on by default

4.            #vendor@org.sakaiproject.service.framework.sql.SqlService=hsqldb

5.            #driverClassName@javax.sql.BaseDataSource=org.hsqldb.jdbcDriver

6.            #hibernate.dialect=org.hibernate.dialect.HSQLDialect

7.            #validationQuery@javax.sql.BaseDataSource=select 1 from SYSTEM_USERS

8.            # two hsqldb storage options: first for in-memory (no persistence between runs), second for disk based

9.            #url@javax.sql.BaseDataSource=jdbc:hsqldb:.

10.        #url@javax.sql.BaseDataSource=jdbc:hsqldb:${sakai.home}/db/sakai.db

11.   Find the section: ## MySQL settings and uncomment the 6+ lines in it

12.        ## MySQL settings - make sure to alter as appropriate

13.        vendor@org.sakaiproject.db.api.SqlService=mysql

14.        driverClassName@javax.sql.BaseDataSource=com.mysql.jdbc.Driver

15.        hibernate.dialect=org.hibernate.dialect.MySQLDialect

16.        url@javax.sql.BaseDataSource=jdbc:mysql://127.0.0.1:3306/sakai?useUnicode=true&characterEncoding=UTF-8

17.        validationQuery@javax.sql.BaseDataSource=select 1 from DUAL

18.        defaultTransactionIsolationString@javax.sql.BaseDataSource=TRANSACTION_READ_COMMITTED

§         Note that this line may be incorrect in the default file, it should read as shown:

§                 vendor@org.sakaiproject.db.api.SqlService=mysql

4.       Save the changes to the file

10. Create maven build.properties file

0.       Create a new text file in your user home directory

§         Note: This is probably c:/documents and settings/<username> in Windows

1.       Add the following lines:

2.      maven.repo.remote = http://source.sakaiproject.org/maven/

3.      maven.tomcat.home = /opt/tomcat/

§         Note: The trailing slashes are required

§         Note: You must use forward slashes

§         Note: You must have spaces around the "="

§         Note: Do not change / to / if using windows

§         Note: DO add c: to the path if using windows

11. Use Maven to build Sakai

0.       Open a command line shell

1.       Change directory to /opt/<sakai-src>

2.       Execute maven bld to build Sakai using maven

§         Do NOT use maven sakai the first time or your build will take 5-10 times longer!

§         Note: The build will take an extra 5-10 minutes to download dependencies the first time

3.       Execute maven dpl to deploy Sakai to your tomcat using maven

4.       Add the maven plugin to allow for partial builds in Sakai
Run the following command from the sakai source root:

5.       maven plugin:download -DartifactId=sakai -DgroupId=sakaiproject -Dversion=2.2
You can now do a "maven sakai" from any subdirectory and build just that code

6.       For future builds, use maven sakai which does a clean, build, and deploy
(it is basically the same as doing maven cln bld dpl)

12. Start Tomcat and check to make sure Sakai runs

0.       Start tomcat using $CATALINA_HOME/bin/startup

1.       Allow 1 minute+ for tomcat to start up

2.       Open http://localhost:8080/ to verify tomcat is running

3.       Open http://localhost:8080/portal to verify sakai is running

4.       Login to sakai as username:admin, password:admin

5.       Shutdown Tomcat using $CATALINA_HOME/bin/shutdown

13. Install Eclipse 3.2+ stable

o        Eclipse - http://www.eclipse.org/

§         Note: If you already have eclipse 3.1.x installed, your best best is to start over with a fresh install rather than attempting to upgrade

§         Note: If you have not installed eclipse already, you should download the WebTools Platform: All-in-one package for Eclipse 3.2 which includes Eclipse and all of the necessary webtools packages, this is much faster and easier than downloading them seperately, you can skip the WebTools step if you do this, here are instructions to install the Eclipse WebTools

1.       Download the newest stable version http://www.eclipse.org/

2.       Extract the downloaded file to /opt

§         Windows users should extract to c:/

§         Mac users should use the installer and put it in Applications

3.       Run eclipse to verify it works (/opt/eclipse/eclipse)

§         Windows users: c:/eclipse/eclipse.exe to run eclipse

§         Note: If it does not work, there is probably a problem with your java install

4.       Set the memory settings for Eclipse

§         The default memory settings for Eclipse are much too low to handle the number of webapps in a full Sakai installation

1.       Shutdown eclipse if it is running

2.       Edit the eclipse.ini file in the directory you extracted/installed eclipse

3.       Change the settings from this:

4.            -vmargs

5.            -Xms40m

6.            -Xmx256m

to this:

-vmargs

-Xms256m

-Xmx768m

§         Windows users should not use notepad to edit this file, use wordpad or edit (command line)

§         Mac users will need to take additional steps to edit the eclipse.ini file

2.       Control-click on the Eclipse Application icon and select Show Package Contents

3.       Double-click on the Contents folderD

4.       Double-click on the MacOS folder, the eclipse.ini file should be here

5.       Full path: eclipse/Eclipse.app/Contents/MacOS/eclipse.ini

5.       Set the JVM

§         The default JVM will be the one in the JRE, things will work better if you change this to the one in the J2SE

1.       Startup eclipse if it is not running

2.       Select Window -> Preferences -> Java -> Installed JREs

3.       Select the current installed JRE

4.       Click the Edit button

5.       Click Browse and navigate to the home directory of your JAVA installation (e.g. /opt/java)

6.       Click OK to save and then OK to Finish

§         Running Eclipse with a different JVM from the default
Add
-vm /opt/java/bin/java after the eclipse executable

§         You must include the full path to the java executable file

o        More Eclipse tips here: ARW:Eclipse notes

14. Add Eclipse Web Tools Project (WTP)

o        Web Tools Project - http://www.eclipse.org/webtools/

1.       Manual installation (faster)

§         http://www.eclipse.org/webtools/

1.       Download WTP 1.5+ to your desktop

2.       Shutdown Eclipse

3.       Extract the package to your Eclipse installation directory

4.       Startup Eclipse

2.       Install using the Eclipse updater (easier)

0.       Start eclipse

1.       Select Help -> Software Updates -> Find and Install

2.       Select Search for new features to install, click Next

3.       Choose the Eclipse.org Update Site and click Finish

4.       Select WTP 0.7 (or newer)

§         Note: If it is not listed, use the following update URL:
http://download.eclipse.org/webtools/updates/

5.       Click Select Required

6.       Click Next and follow installation instructions

7.       Accept terms, click Finish

8.       Click Install All

9.       Restart the workbench when asked

3.       WebTools Platform: All-in-one (fastest)

§         http://www.eclipse.org/webtools/

§         This should only be used if you do not already have Eclipse installed

2.       Click on downloads to the right side of the page

3.       Click on the most current 1.5 build version

§         Note: There does not appear to be an all-in-one package for 1.5.3 so we recommend you choose 1.5.2 instead

4.       Locate the All-in-one packages and download the appropriate one for your platform

5.       Extract the package to whereever you want to install eclipse (normally your drive root)

6.       Startup Eclipse

15. Add subclipse to Eclipse

o        Subclipse - http://subclipse.tigris.org/

1.       Startup eclipse

2.       Select Help -> Software Updates -> Find and Install

3.       Select Search for new features to install, click Next

4.       Click New Remote Site

5.       Enter Subclipse for the name

6.       Enter http://subclipse.tigris.org/update_1.2.x for the URL

§         If you are using Eclipse 3.1 or older, you must use http://subclipse.tigris.org/update_1.0.x instead
Note: We highly recommend you upgrade to eclipse 3.2+

7.       Click Finish

8.       Check the Subclipse box and click Next

9.       Accept terms, click Next, click Finish, click Install All

10.   Restart the workbench when asked

o        Add bin and target to global svn ignore in Eclipse (Optional)

§         This will keep you from committing bin and target directory files when you add projects to svn

1.       Click on Window -> Preferences

2.       Select Team -> Ignored Resources

3.       Click on Add Pattern and enter "bin"

4.       Click on Add Pattern and enter "target"

5.       Click on Apply and then OK

16. Add SpringIDE to Eclipse

o        SpringIDE - http://springide.org/project

1.       Startup Eclipse

2.       Select Help -> Software Updates -> Find and Install

3.       Select Search for new features to install, click Next

4.       Click New Remote Site

5.       Enter Spring IDE updatesite for the Name

6.       Enter http://springide.org/updatesite/ for the URL

7.       Click OK

8.       Check the box marked "Spring IDE updatesite" and click Finish

9.       Check the Spring IDE box and click Next

10.   Accept terms, click Next, click Finish, click Install All

11.   Restart the workbench when asked

17. Import Sakai source code into Eclipse

0.       Startup eclipse if it is not running

1.       Create a new workspace for Sakai

0.       Click on File -> Switch Workspace

1.       Enter "WS-Sakai" in place of the default "workspace" directory

2.       Click OK (eclipse will restart)

§         The following steps should be done in the WS-Sakai workspace

2.       Add Maven Repository libraries to classpath

0.       Select Window -> Preferences -> Java -> Build Path -> Classpath Variables

1.       Add MAVEN_REPO classpath variable with the path to the local maven repository

§         The path should be: $USER_HOME/.maven/repository

3.       Switch to the Java perspective (Window -> Open Perspective -> Java)

§         Make sure you are in the package explorer

4.       Turn off Automatic builds

§         Select Project and uncheck Build automatically

5.       Select File -> Import -> Existing Projects into Workspace

0.       Enter the full path to the sakai source directory for the root directory

§         This should be /opt/cafe-2.2.x if you followed the steps in this document

1.       Click Deselect All to unselect all projects

2.       Select the following projects (you only need most of the APIs, a few utils, and all of the db projects)
alias-api
announcement-api
archive-api
authz-api
component-api
content-api
courier-api
db-api
db-impl
db-util
entity-api
email-api
event-api
jsf
message-api
master
site-api
site-manage-api
tool-api
user-api
util-api
util-util
velocity

3.       Click Finish to import the selected projects

§         This will take awhile, probably 5+ minutes

6.       Create a working set for Sakai (optional)

§         You do not have to create a working set, these are here in case you want to

1.       Switch to the Java perspective

2.       In the Package Explorer pane click the drop-down arrow menu and choose Select Working Set

3.       Click the New button from the Select Working Set Dialog window

4.       Choose Java for the Working Set Type and click Next

5.       Enter Sakai as the name for your Working Set

6.       Select the imported Sakai projects and click Finish

7.       Build Sakai in Eclipse

§         Initially you will get build failures on almost every Sakai project, this is because they are building in the default order and their dependencies are in a different order, this has been partially addressed in Sakai 2.2

1.       Clean all Sakai projects

0.       Select Project -> Clean

1.       Select Clean all projects

2.       Check Start a build immediately

3.       Click OK

2.       Build All (Project -> Build All)

§         Do this if using working sets:
Build the Sakai working set (Select Project -> Build Working Set -> Sakai)

§         Repeat this step until no errors remain (should be no more than 3-4 times)

§         There will be hundreds of warnings, do not worry about these

8.       Turn back on Automatic builds

§         Select Project and check Build automatically

Children   Hide Children | View in hierarchy

Install Java 1.4.2 (WG: Programmer's Cafe)
Install Java 1.5
(WG: Programmer's Cafe)
Install Maven 1.0.2
(WG: Programmer's Cafe)
Install MySQL 4.1
(WG: Programmer's Cafe)
Install Mysql Connector 3.1
(WG: Programmer's Cafe)
Sakai 2.2 developer JVM tuning
(WG: Programmer's Cafe)
原创粉丝点击