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
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
$ 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
# 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
# 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
$ 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
# 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
# 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
# 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
<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.
# don't forget to update the path
export JAVA_HOME="/your/java/path"
export JAVA_OPTS="-server -Xmx4g -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.demo=true"
JAVA_OPTS="$JAVA_OPTS --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED --add-exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED --add-exports=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED --illegal-access=permit"
One last step inside tomcat9
directory
$ cd tomcat9/bin
# to make the file executable
$ chmod +x *.sh
8. Final Step, time to clone the Sakai git repository:
$ 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
# 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