Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

1.0 Install Prerequisites


To begin with the following items must be installed (you may skip any you all ready have installed.

...

Sakai 20.0 was QA tested with Java 1.8.0_252, maven 3.5. (though maven-3.3.9 should also work), Apache Tomcat 9.0.19


1.1 Verify/Install Java 1.8 


Oracle's Sun Java SE 8, a.k.a Java 1.8, is the required version to use with the Sakai. Certain files, such as *.jsp and *.jws, require compilation so downloading and attempting to use only the run time environment (JRE 8.0) will not suffice.  

...

openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~18.04-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
1.1.1 Set Java environment variables 


Several environment variables and related properties must be set for Java. 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 JAVA_HOME via the GUI.

...

(warning) Windows: append the string to the end of the Path system variable

Set JAVA_OPTS

The default Java virtual machine (JVM) settings are insufficient for an application of Sakai's size. As a result several JVM parameters must be increased for Sakai to run, while others may need to be adjusted for optimal performance.

...

In the case your locale is not fully supported in Java (as it happens with Basque or Mongolian languages) you should read this information:
Endorsed I18n Project 

Specify an HTTP Proxy (optional)

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


1.2 Install Git and/or local Github client 


The Sakai Community uses Github as its source control management (SCM) system. Use a reasonably current version of Git to get the source. Alternatively, you can obtain binary packages for Mac/Linux and Windows (Linux is more popular and gets the preponderance of QA testing, by far). Extract the distribution archive into your installation directory. 

https://github.com/sakaiproject/sakai



1.3 Install Maven 3 


The Apache Maven project management framework provides Sakai with "a set of build standards, artifact repository model and a software engine that manages and describes projects" (Better Builds, p. 22). As part of the installation process you will use Maven as a build tool in order to compile, test and deploy Sakai to a servlet container such as Apache Tomcat.

...

Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T14:33:14-04:00)
Maven home: /usr/share/maven3
Java version: 1.8.0_252, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-65-generic", arch: "amd64", family: "unix"


1.3.1 Set Maven environment variables 


A number of environment variables must be set for optimal Maven performance. 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 Maven environment variables via the GUI.

...

(warning) Windows: append string to the end of the Path system variable

MAVEN_OPTS

Maven does not read JAVA_OPTS on start up, resulting occasionally in "Out of Memory" errors when building Sakai. To assure sufficient memory allocation during builds, you should add a MAVEN_OPTS environment variable as defined below. 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 MAVEN_OPTS via the GUI.

export MAVEN_OPTS='-Xms512m -Xmx1024m'


1.4 Install Tomcat 9


  • Apache Tomcat - http://tomcat.apache.org/
  • Note: Always do a fresh install of Tomcat 9
  • Note: Windows users should ensure that there are no spaces in the complete tomcat path as this causes errors with JSF tools in Sakai
    GOOD: C:\opt\tomcat\, C:\sakaistuff\installs\tomcat\
    BAD: C:\program files\tomcat\, C:\opt\apache tomcat 9.0.19\
  1. Download Tomcat 9 - https://tomcat.apache.org/download-90.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


  2. Extract to /opt (symlink the apache-tomcat-9.0.x directory to tomcat after extracting)
    • Example (assuming you have saved the file as /opt/apache-tomcat-9.0.x.tar.gz)

      cd /opt
      tar xzvf apache-tomcat-9.0.x.tar.gz
      ln -nsf apache-tomcat-9.0.x tomcat


    • Windows users should either rename the directory or, if comfortable, create a directory junction using an elevated cmd prompt:

      mklink /J C:\apache-tomcat-9.0.x C:\tomcat


  3. Modify conf/server.xml for international character support
    1. Add URIEncoding="UTF-8" to the Connector element
      • <Connector port="8080" URIEncoding="UTF-8" ...
  4. Set environment variable: CATALINA_HOME=/opt/tomcat
  5. Add $CATALINA_HOME/bin to PATH
  6. Setup the SETENV file in the tomcat/bin directory with JAVA_OPTS.

  7. You can populate the database with Demo data or use the quartz job Create Test Sites (Not recommended for production environments)

    1. Using the quartz job will create some sample sites with some sample data in tools ideal for testing
    2. Another alternative instead of starting with an empty database you can add the flag -Dsakai.demo=true in addition to the others shown here. During your first Tomcat launch it will populate your database with test data (students, courses, etc). Once the data has been created remove this flag for subsequent Tomcat launches. Be advised that this flag will not trigger on a database with data already in it so you must make this choice during the initial setup. It should also be noted that without this flag one will not be able to create any course sites in Sakai unless Academic Term, Subject, Course, and Section data is manually added to the "cm_" tables in the database.


      1. Mac/Linux: Create a file called setenv.sh with the following (alternately, you can put this into your .bashrc file so they're automatically executed):
        Tomcat 9 Mac/Linux

        export JAVA_OPTS="-server -d64 -Xms1g -Xmx2g -Djava.awt.headless=true -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC"
        JAVA_OPTS="$JAVA_OPTS -Dhttp.agent=Sakai"
        JAVA_OPTS="$JAVA_OPTS -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false"
        JAVA_OPTS="$JAVA_OPTS -Djava.util.Arrays.useLegacyMergeSort=true"
        JAVA_OPTS="$JAVA_OPTS -Dsakai.security=$CATALINA_HOME/sakai/"
        JAVA_OPTS="$JAVA_OPTS -Duser.timezone=US/Eastern"
        JAVA_OPTS="$JAVA_OPTS -Dsakai.cookieName=SAKAI2SESSIONID"
        JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8089 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"


      2. Windows(PC): Create a file called setenv.bat with the following:
        Tomcat 9 Windows

        set JAVA_OPTS=-server -Xmx1028m -XX:MaxMetaspaceSize=512m -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Djava.awt.headless=true -Dcom.sun.management.jmxremote -Dhttp.agent=Sakai -Djava.util.Arrays.useLegacyMergeSort=true -Dfile.encoding=UTF8


  8. [OPTIONAL] Delete the default webapps from the webapps dir

    rm -rf webapps/*
    
Improve startup speed

You can improve startup speed under Tomcat significantly.

For Sakai 12 and earlier: Edit the file conf/context.xml and add this JarScanFilter block to the <Context>

       <JarScanner>
        <!-- This is to speedup startup so that tomcat doesn't scan as much -->
        <JarScanFilter defaultPluggabilityScan="false"
defaultTldScan="false"
tldScan="jsf-impl-*.jar,jsf-widgets-*.jar,myfaces-impl-*.jar,pluto-taglib-*.jar,sakai-sections-app-util-*.jar,spring-webmvc-*.jar,standard-*.jar,tomahawk*.jar,tomahawk-*.jar"/>
    </JarScanner>

 

For Sakai 19 and later: After the JSF 2.3 migration, users may update the tomcat configuration to this one:

<JarScanner>
    <!-- This is to speedup startup so that tomcat doesn't scan as much -->
    <JarScanFilter defaultPluggabilityScan="false" />
</JarScanner>


2.0 Get the Sakai source code


There are two ways to acquire Sakai source code. You can choose to download a packaged *.zip or *tar.gz file from Sakai's release page or check out the code directly from our code repository using Git's source code control system and Github as the repository hosting service.

 Sakai source code can be checked forked from our Github repository. The latest development work is located in the master branch; stable releases can be found in tags while maintenance and other work is performed in a 20.x branch.

20 release tag

To checkout a stable release tag, clone the git repo and then checkout the tag (in this case 20.0):

...

The latest stable release may be newer than the version listed above. Please see https://github.com/sakaiproject/sakai/releases.

20.x maintenance branch

The latest bug fixes for a particular release can be found in our maintenance branches. Please note that certain maintenance branch fixes require database schema changes. You can check out the maintenance branch by issuing the following command from the terminal:

...

If you all ready have cloned the repository, skip step the clone step above.


3.0 Configure Sakai 


1.0 Create a sakai.properties file


The sakai.properties file is a central configuration file that is typically stored in a /sakai subdirectory relative to the Tomcat home directory ($CATALINA_HOME). It is a non-XML text file containing a series of key/value pairs that is read using the load method of java.util.properties. Settings in sakai.properties govern everything from setting your institution's name to configuring your database. All settings in sakai.properties are read on startup; any changes you make subsequently will only take effect when you restart web application server. You may want to create a local.properties file in the same directory as sakai.properties. Properties listed in local.properties override sakai.properties. 

...


(info) For list of sakai.properties settings see the Sakai Properties Reference; for detailed documentation on the full variety of possible sakai.properties settings, see the sakai_properties.doc in /reference/docs/architecture/sakai_properties.doc.


2.0 Configure home page tool set per site


Tool collections for the home page can be configured for each site type. However, if the wsetup.home.toolids.* property is not set, the Worksite setup tool will default to the following set of tools for the home page: sakai.iframe.site, sakai.summary.calendar, sakai.synoptic.announcement, sakai.synoptic.chat, sakai.synoptic.messagecenter. Synoptic tools will be added or dropped from home page depending on whether their linked tool exists in the site or not. See SAK-15504 - Upgraded site: editing My workspace leads to duplicate Home CLOSED and SAK-16747 - tools are not auto-added into Home tool page CLOSED for more details.

wsetup.home.toolids.count=5
wsetup.home.toolids.1=sakai.privacy
wsetup.home.toolids.2=sakai.iframe
wsetup.home.toolids.3=sakai.synoptic.announcement
wsetup.home.toolids.4=sakai.synoptic.chat
wsetup.home.toolids.5=sakai.synoptic.messagecenter


3.0 Work site setup group helper


A new group helper is enabled by default (see SAK-13413 - Group creation enhancement CLOSED for more details). Site maintainers can now create groups based on sections and roles. To switch back to the old 2.5 style of group helper (ad-hoc only), one needs to add following setting in sakai.properties:

wsetup.group.helper.name = sakai-site-manage-group-helper 


4.0 Session timeout warning


Sakai includes a property called inactiveInterval@org.sakaiproject.tool.api.SessionManager, which dictates the length of inactive time before a users session times out and allows for the enabling of a session timeout warning. Session status is now checked by the Sakai portal. If the remaining session time is less than the warning time (say 10 minutes). When a session expires, the any page requests are redirected to the URL indicated by the loggedOutUrl sakai property. See SAK-13987 - Session Timeout Popup Utilizing Polling data from entity broker CLOSED SAK-8152 - Sakai should warn a user before the user's session times out and data is inadvertently lost CLOSED for more details.

To enable the session timeout warning, set the following properties in your local sakai.properties with a time interval of your choosing:

timeoutDialogEnabled=true
timeoutDialogWarningSeconds=600


5.0 Configure email


Enabling Sakai to both send and receive email requires setting a number of properties in sakai.properties. In order to send mail Sakai requires the address (name or IP) of an external SMTP server that will accept mail from Sakai:

...

# Email support address used in incoming email rejection messages.
mail.support=address@somedomain
# A variation on this that's used in some places instead of the one above! Best to set both of them
support.email
 
#To change the postmaster address in general
smtpFrom@org.sakaiproject.email.api.EmailService
# Email address to send errors caught by the portal, and user bug reports in response.
portal.error.email=address@somedomain

# Email address used as the "from" address for any email sent by Worksite Setup tool or Site Info tool.
setup.request=address@somedomain

# Send an email to the user when the user is added.
notifyNewUserEmail=true

 
#For msgcntr notifications
msgcntr.notification.from.address
 
#Whether or not to send the real address as msgcntr notifications
msgcntr.notification.user.real.from=true (false)
 
 


6.0 Configure logging


Once you have Sakai installed, configured and started, you can monitor Sakai by watching the logs. The log level for the standard Sakai source code and the demo is set to show info and warnings only. Watch for the WARN: messages. There are going to be some "normal" ones at startup, and some will likely slip by at runtime, but any warning is potentially something you might want to check out.

...

(info) The SMTP server logs from Sakai will be written to the $CATALINA_HOME/sakai/logs directory.


7.0 Managing temporary files

Depending on usage, Sakai may create many large temporary files in the system temporary file storage location (e.g. /tmp). It is a good practice to routinely remove temporary files older than a day, especially if you have a lot of users or have heavy usage of mail sending with attachments. Note that you should not simply remove all temp files on a schedule as some of them may be in active use (also be careful about removing temp files which are used by other processes).


3.1 Configure database


Sakai 20 database support details

...

mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 272

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database sakai  default character set utf8;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on sakai.* to sakaiuser@'localhost' identified by 'sakaipassword';
Query OK, 0 rows affected (0.00 sec

mysql> grant all on sakai.* to sakaiuser@'127.0.0.1' identified by 'sakaipassword';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit


4.0 Build, deploy and start up Sakai in Tomcat 


Install the Sakai master project

Sakai makes use of Maven's Project Object Model to provide an XML representation of basic project information covering dependency management, build targets, external repositories, issue tracking, mailing lists, reporting plugins, developer bios, etc. A top-level master pom.xml file located in the /master project acts as a parent for other Sakai pom.xml files. If you are building Sakai for the first time you should install the master project first by issuing the clean and install goals from the /master project folder.

cd master
mvn clean install
cd ..

Install and deploy Sakai

Once you have built the master pom, issue the following Maven goals from the top-level Sakai source directory:

...

You can also issue mvn clean install sakai:deploy from any sakai project module top-level folder in order to build and deploy portions of Sakai such as individual tools.

Maven Goal Options

There are a number of other ways to build and deploy Sakai using Maven:

Print debug output

mvn -X clean install sakai:deploy

Build and Deploy in offline mode

If your local repository contains all Sakai project dependencies, you can run Maven "offline" by adding the -o option:

mvn -o clean install sakai:deploy

Skip unit tests

There may be occasions when you want to build and deploy Sakai without executing the set of unit tests that accompany many of the Sakai modules. If so add -Dmaven.test.skip=true to the goals you issue:

mvn clean install -Dmaven.test.skip=true sakai:deploy

Build and Deploy with exploded wars

The normal build will deploy the war files which when tomcat starts will expand them, you can forgo this intermediate step and deploy expanded war files which occupy much less space:

mvn clean install sakai:deploy-exploded

4.1 Start/Stop Tomcat 


Start/stop Tomcat from the terminal by running the appropriate startup/shutdown script located in $CATALINA_HOME/bin:

...