Sakai v20.1 LMS — Chapter 1: Installation(Mac)

abc101
3 min readOct 20, 2020

Installation Guide (Binary) on Mac

Pre-requisites

  1. Oracle Java 1.8 (macOS x64)
  2. Tomcat 9 (Core: zip or tar.gz)
  3. MySQL or MariaDB
  4. Sakai (sakai-bin-20.1.tar.gz)

Install Java 1.8

Install Java 1.8 followed by instruction.

Check the Java version and location.

$ java -version
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)
$ which java
/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/bin/java

Set “JAVA_HOME” in the ‘.bashrc’ or ‘.zshrc’

export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home"export PATH=$JAVA_HOME/bin:$PATH

Install Tomcat 9

Download and extract Tomcat9 from a web browser or ‘wget’ if you have it.

$ wget https://mirrors.sonic.net/apache/tomcat/tomcat-9/v9.0.39/bin/apache-tomcat-9.0.39.tar.gz
$ tar xvzf apache-tomcat-9.0.39.tar.gz

Move ‘Tomcat’ under ‘/usr/local/’

$ sudo mv apache-tomcat-9.0.39 /usr/local/tomcat9

Set Tomcat path in the ‘.bashrc’ or ‘.zshrc’.

export CATALINA_HOME="/usr/local/tomcat9"
export PATH=$CATALINA_HOME:$PATH

Reload .bashrc or restart the terminal to read the ‘.bashrc’ settings and check the tomcat startup.sh

$ source ~/.bashrc
$ which statrtup.sh
/usr/local/tomcat9/bin/startup.sh

Set Tomcat for Sakai

Create a file called ‘setenv.sh’ with

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 -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"

in the ‘/usr/local/tomcat9/bin/’.

$ cd $CATATLINA_HOME
$ vi bin/setenv.sh

Remove default tomcat app from ‘tomcat9/webapps’.

$ rm -rf webapps/*

Add

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

to the <Context> block of the ‘conf/context.xml’.

Install Sakai v20.1

Unpack the Sakai binary distribution and move in the $CATALINA_HOME/sakai

$ mv ~/Downloads/sakai-bin-20.1.tar.gz $CATALINA_HOME/
$ cd $CATALINA_HOME
$ tar xvzf sakai-bin-20.1.tar.gz

Create a folder named $CATALINA_HOME/sakai and a file named ‘local.properties’ to the folder.

$ cd $CATALINA_HOME 
$ mkdir sakai
$ touch local.properties

Add database connection in the ‘local.properties’. (MySQL)

username@javax.sql.BaseDataSource=sakaiuser
password@javax.sql.BaseDataSource=sakaipassword
## MySQL settings
vendor@org.sakaiproject.db.api.SqlService=mysql
driverClassName@javax.sql.BaseDataSource=com.mysql.jdbc.Driverhibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
url@javax.sql.BaseDataSource=jdbc:mysql://127.0.0.1:3306/sakaidatabase?useUnicode=true&characterEncoding=UTF-8
validationQuery@javax.sql.BaseDataSource=select 1 from DUAL
defaultTransactionIsolationString@javax.sql.BaseDataSource=TRANSACTION_READ_COMMITTED

If you use MariaDB, change the driver.

#driverClassName@javax.sql.BaseDataSource=com.mysql.jdbc.Driver
driverClassName@javax.sql.BaseDataSource=org.mariadb.jdbc.Driver

Prepare DATABASE

Create database and database user.

mysql -u root -p...> CREATE DATABASE sakaidatabase DEFAULT CHARACTER SET utf8;
> GRANT ALL ON sakaidatabase.* TO sakaiuser@localhost IDENTIFIED BY 'sakaipassword';
> FLUSH PRIVILEGES;
> QUIT

Start Sakai

It will take a long time about 20 minutes because Sakai database will be created at the first start. To watch the log, use ‘tail’.

$ startup.sh && tail -f $CATALINA_HOME/logs/catalina.out...
19-Oct-2020 20:31:45.161 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
19-Oct-2020 20:31:45.178 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [119013] milliseconds

Visit the Sakai portal, “localhost:8080/portal”, with your prefer web blower.

[Default id: admin password: admin]

Stop the “tail” and shutdown Sakai.

[ctrl + c]
$ shutdown.sh

If you have errors such as “Port already in use: 8089; nested exception is:” kill the process.

$ ps -ef | grep tomcat...$ kill [procees number]

--

--