How to install Sakai 22 on Mac OS

This quick guide will help you to run Sakai locally on your system.

 Instructions

Requirements

Java-11(JDK)
maven-3.6
tomcat-9
MySQL-8 or MariaDB-latest

 

 

  1. Download Java-11

You can also download the open JDK version from this link, But its easier to find the path of Oracle JDK (i.e Library/Java/JavaVirtualMachines/your jdk version )

 

2. Download Maven-3.6

 

3. Move Maven to the application folder

1 2 3 $ cd Downloads/ # move apache maven to the applications folder $ mv apache-maven-3.6.3 /Applications/

 

4. Set up the paths for Maven and Java

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 # check if you already have a .zshrc file, (if not create one $touch .zshrc) # to check whether it exists or not $ ls -a # now open the file $ open -e .zshrc # set maven path(copy and paste the below to your .zshrc file) export MAVEN_HOME=/Applications/apache-maven-3.6.3 export PATH=$PATH:$MAVEN_HOME/bin export MAVEN_OPTS='-Xms1024m -Xmx2048m' # set java path export JAVA_HOME=/Library/Java/JavaVirtualMachines/your jdk file name/Contents/Home export PATH=$JAVA_HOME/bin:$PATH

After saving the .zshrc file, restart your terminal. And Verify If its working

java --version for java, and mvn --version for maven. If all seems good, then follow the next steps.

 

5. Install MySQL

1 2 3 4 5 6 7 8 9 10 11 12 # Install brew, ignore if you have brew installed $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Install mysql $ brew install mysql $ brew services start mysql # setup the root passowrd, {0,root password=root1234 and Y to all} $ mysql_secure_installation # restart mysql server $ brew services restart mysql

Set up the MySQL for Sakai to use

1 2 3 4 5 6 7 8 $ mysql -u root -p # enter the password root1234 $ create database sakaidb default character set utf8; $ create user 'sakaiuser'@'localhost' identified by 'sakaipassword'; $ grant all on *.* to 'sakaiuser'@'localhost'; $ create user 'sakaiuser'@'127.0.0.1' identified by 'sakaipassword'; $ grant all on *.* to 'sakaiuser'@'127.0.0.1'; $ flush privileges;

 

6. Almost done, Create a directory for Sakai

1 2 3 4 5 6 7 8 9 10 11 # from your home directory($cd) # create a folder to keep all sakai stuff $ mkdir sakai-workspace $ cd sakai-workspace # create a folder/file to keep sakai.properties $ mkdir home $ cd home $ touch sakai.properties # open sakai.properties $ open ~/sakai-workspace/home/sakai.properties

Now paste all of the below codes inside sakai.properties

1 2 3 4 5 6 7 8 9 10 11 # mysql username and password username@javax.sql.BaseDataSource=root password@javax.sql.BaseDataSource=root1234 ## MySQL settings vendor@org.sakaiproject.db.api.SqlService=mysql driverClassName@javax.sql.BaseDataSource=org.mariadb.jdbc.Driver hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect url@javax.sql.BaseDataSource=jdbc:mysql://127.0.0.1:3306/sakaidb?useUnicode=true&characterEncoding=UTF-8?useSSL=false validationQuery@javax.sql.BaseDataSource=select 1 from DUAL defaultTransactionIsolationString@javax.sql.BaseDataSource=TRAN

Save the file.

 

7. Download the latest apache-tomcat

extract the tomcat in the sakai-workspace folder and rename the apache-tomcat as tomcat9

1 2 3 4 5 6 # from your home dir(to go inside home dir $ cd ) $ cd sakai-workspace $ cd tomcat9 # removing the tomcat default files $ rm -rf webapps/*

Add the below code snippet to the <Context> block of the tomcat9/conf/context.xml

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

Now, create a file name setevn.sh in tomcat9/bin directory and paste the below code snippets.

1 2 3 4 5 6 7 8 9 10 11 12 # don't forget to update the path export JAVA_HOME="/your/java/path" export JAVA_OPTS="-server -Xmx4g -XX:MaxMetaspaceSize=1g -Djava.awt.headless=true -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -Djava.util.Arrays.useLegacyMergeSort=true" 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=/Users/yourusername/sakai-workspace/home/" JAVA_OPTS="$JAVA_OPTS -Dsakai.home=/Users/yourusername/sakai-workspace/home/" JAVA_OPTS="$JAVA_OPTS -Dsakai.cookieName=SAKAI2SESSIONID" JAVA_OPTS="$JAVA_OPTS -Dsakai.demo=true" JAVA_OPTS="$JAVA_OPTS -Duser.timezone=US/Eastern" JAVA_OPTS="$JAVA_OPTS -Duser.language=en -Duser.region=ES"

One last step inside tomcat9 directory

1 2 3 $ cd tomcat9/bin # to make the file executable $ chmod +x *.sh

 

8. Final Step, time to clone the Sakai git repository:

1 2 3 4 5 $ cd sakai-workspace $ git clone https://github.com/sakaiproject/sakai.git $ cd sakai # finally run this cmd to build the Sakai, REPLACE THE USERNAME $ mvn clean install -Dmaven.test.skip=true -T 4C -Dmaven.tomcat.home=/Users/youruserename/sakai-workspace/tomcat9 -Dsakai.home=/Users/yourusername/sakai-workspace/home sakai:deploy

After the build is complete

1 2 3 4 5 6 7 # Its time to run your Sakai server now $ cd sakai-workspace/tomcat9 # to start the sakai server $ bin/startup.sh; tail -f logs/catalina.out # to stop the server $ cntrl + c $ bin/shutdown.sh

 

Congratulation , Here’s your Sakai http://127.0.0.1:8080/portal

 

 

 

If you get stuck or need more help, email us here: sakai-dev@apereo.org