SAKAI 2.9 Install Guide
STEP 1: Install Oracle Java 7
- Remove OpenJDK
sudo apt-get purge openjdk*
- Add PPA, Update then Install JDK7
sudo add-apt-repository ppa:eugenesan/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
STEP 2: Install Tomcat
- Download tomcat 7 – http://tomcat.apache.org/download-70.cgi (.tar.gz)
- Extract to /opt
- Create a symbolic link
ln -s /opt/apache-tomcat-7.[your version] /opt/tomcat
Setup the environment variables
- Setup the SETENV file in the tomcat/bin directory with JAVA_OPTS
sudo gedit /opt/tomcat/bin/setenv.sh
- JAVA_OPTS to add to setenv.sh
export JAVA_OPTS=
"-server -Xmx1028m -XX:MaxPermSize=320m -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Djava.awt.headless=true -Dcom.sun.management.jmxremote -Dsun.lang.ClassLoader.allowArraySyntax=true"
- Configure tomcat 7 to use the old tomcat 5.5 classloader dirs
- Edit /opt/tomcat/conf/catalina.properties
i. Add the following to the line that begins with “common.loader=…”
,${catalina.base}/common/classes/,${catalina.base}/common/lib/*.jar
ii. Add the following to the line that begins with “shared.loader=…”
${catalina.base}/shared/classes/,${catalina.base}/shared/lib/*.jar
iii. Add the following to the line that begins with “server.loader=…”
${catalina.base}/server/classes/,${catalina.base}/server/lib/*.jar
iv. Create the directories
mkdir -p shared/classes shared/lib common/classes common/lib server/classes server/lib
Setting Tomcat password and permissions
- Set tomcat permissions
- Edit the tomcat-users.xml file
gedit /opt/tomcat/conf/tomcat-users.xml
- Modify file to read as follows:
<role rolename='tomcat'/>
<role rolename='admin-gui'/>
<role rolename='manager-gui'/>
<role rolename='role1'/>
<user password='tomcat' roles='tomcat,role1' username='both'/>
<user password='tomcat' roles='role1' username='role1'/>
<user password='tomcat' roles='admin-gui,manager-gui,manager,admin' username='tomcat'/>
- Restart tomcat
sh /opt/tomcat/bin/shutdown.sh
sh /opt/tomcat/bin/startup.sh
The default Tomcat username and password will now be tomcat
STEP 3: Install MySQL & Apache
- To check: Run mysql –help on the command line
- If not, install MySQLby issuing the following install command (apt-get) on the terminal:
sudo apt-get install mysql-server mysql-client libmysqlclient15-dev - Install apache and phpmyadmin:
sudo apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert phpmyadmin
STEP 4: Download and setup MySQL Connector/J stable
Assumption is that you have mysql 5+ installed
- Download connector for your version of MySQL If running MySQL 5.0.x Download version 5.0.4+ fromhttp://dev.mysql.com/downloads/connector/j/5.0.html
- Extract the file
- Copy mysql-connector-java-<version>-bin.jar to $CATALINA_HOME/common/lib
Note: $CATALINA_HOME in this example is /opt/tomcat
STEP 5: Download and setup Maven 2.0.6+ stable package
You can install maven directly using the apt-get command on your terminal as shown below (NB: this works better as it sets most configurations right, the download extract method is crappy..):
sudo apt-get install maven2
Create a local Maven repository
Create a local Maven repository (.m2) in your home directory:
cd $HOME
mkdir -p .m2/repository
Create a Maven settings.xml file
Create settings.xml in your .m2 directory. Add the following, specifying the actual location of your Tomcat home directory (in this example /opt/tomcat).
<settings xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>tomcat7</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<appserver.id>tomcat7</appserver.id>
<appserver.home>/opt/tomcat</appserver.home>
<maven.tomcat.home>/opt/tomcat</maven.tomcat.home>
<sakai.appserver.home>/opt/tomcat</sakai.appserver.home>
<surefire.reportFormat>plain</surefire.reportFormat>
<surefire.useFile>false</surefire.useFile>
</properties>
</profile>
</profiles>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.uma.ac.za</host>
<port>80</port>
<username>dns\username</username>
<password>pass</password>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
</proxies>
</settings>
Notice that the username can contain the dns name as shown above, otherwise just supply the username as shown below:
<username>username</username>
NB: The entire proxies tag could also be removed if not working behind a proxy.
STEP 6: Install/Verify you have Subversion
To check is you already have it: Run svn –version on the command line
http://subversion.apache.org/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
Extract to /opt (should create subversion-1.2.3)
Rename it to subversion
mv subversion-1.2.3 subversion
Set environment variable: -1.2.3
Add $SUBVERSION_HOME/bin to PATH
STEP 7: Environment Additional Variables
We realize that the variables we have just set above will be lost once the server is restarted. To avoid this, lets save them in the file specifically meant for system-wide environment(accessible to all users) variable settings.
We need to edit the /etc/profile file. Type the following:
sudo gedit /etc/profile
NOTE 1: Issue root password when prompted
NOTE 2: I tried this on /etc/environment with and without the prefix export and it did not work, cant get past login screen – attempts to log in, shows black screen then back to login window. Press (ctr+alt+f2) to get the terminal, once you have reset environment to default, you will need to reboot as going back to GNOME (alt+f7) will still not work as the changes you made need a restart.
Add the following lines at the bottom of the file on a new line (normally, its after the line “unmask 022″):
NB: before adding JAVA_HOME, confirm the path in /usr/lib/jvm
export HTTP_PROXY=”http://proxy.abc.xyz:80/”
export FTP_PROXY=”ftp://proxy.abc.xyz:80/”
export HTTPS_PROXY=”https://proxy.abc.xyz:80/”
export MAVEN_HOME=/usr/share/maven
export PATH=$PATH:$MAVEN_HOME/bin
export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_41
export PATH=$PATH:$JAVA_HOME/bin
export CATALINA_HOME=/opt/tomcat
export PATH=$PATH:$CATALINA_HOME/bin
export MAVEN_OPTS=”-Xms256m -Xmx645m -XX:PermSize=64m -XX:MaxPermSize=136m”
export SUBVERSION_HOME=/opt/subversion
export PATH=$PATH:$SUBVERSION_HOME/bin
export JAVA_OPTS="-server -Xmx1028m -XX:MaxPermSize=320m -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Djava.awt.headless=true -Dcom.sun.management.jmxremote -Dsun.lang.ClassLoader.allowArraySyntax=true"
Note: If you get an out of memory error, just increase the memory by adjusting the JAVA_OPTS MaxPermSize variable above
Once done, save and close the file.
The variables will still be present when you restart your server.
Note: If operating as root, add the variables in the bash.bashrc file. For each of the variables above, you will not need the “export ” statement.
For instance, open the bashrc file using this command:
vim ~/.bashrc
Add the first variable at the end of the file:
FTP_PROXY=”ftp://proxy.abc.xyz:80/”
Append the other variables in a similar manner, each on a separate line.
STEP 8: Setup Sakai DB (schema) and user
- Create the sakai database and sakai user (password=ironchef)
- Run the following from a command line prompt:
mysql -u root -p
- Then run these commands from the mysql prompt (one command per line):
Note: The name of the database is what you set in the sakai.properties file (Step 10) create database sakai default character set utf8; grant all privileges on sakai.* to 'sakai'@'localhost' identified by 'ironchef'; flush privileges; quit
- [Optional] Download and install mysql query browser
- http://dev.mysql.com/downloads/query-browser/1.1.html
You do not have to do anything with query browser now
STEP 9: Install Sakai 2.9
Before checkout, change directory to /opt/
To checkout a stable release tag issue the following svn command from the terminal:
svn co https://source.sakaiproject.org/svn/sakai/tags/sakai-2.9.2/
Create a directory within tomcat called sakai to host sakai config:
mkdir /opt/tomcat/sakai
Copy the default config from <sakai-src>/config/configuration/bundles/src/bundle/org/sakaiproject/config/bundle/default.sakai.properties to $CATALINA_HOME/sakai/sakai.properties:
mv config/configuration/bundles/src/bundle/org/sakaiproject/config/bundle/default.sakai.properties /opt/tomcat/sakai/sakai.properties
Edit sakai.properties file to set mysql starting at the section marked # DATABASE
We will change two properties,
# HSQLDB settings (DEFAULT) and # MySQL settings
Comment all the lines under
(
# HSQLDB settings (DEFAULT)
)
and uncomment all those under
(
# MySQL settings
)
You now need to set the database username and password
by setting
the
following
variables:
username@javax.sql.BaseDataSource=
yourusername
password@javax.sql.BaseDataSource=
yourpassword
NB: The username and password variables are just above
# HSQLDB settings (DEFAULT). The values should correspond to those you set in step 8 above.
We also need to set the Hibernate dialect. Search for hibernate.dialect and comment the entire “# HSQLDB settings (DEFAULT)” since we are using a different Database.
Uncomment “# MYSQL settings”
You may have called your database something else besides the default name: sakai. The properties are set to point to a database called sakai by default, but you can change this. Under “# Mysql Settings” section, look for the line below:
url@javax.sql.BaseDataSource=jdbc:mysql://127.0.0.1:3306/sakai?useUnicode=true&characterEncoding=UTF-8
The example below points it to a database named sakai290 as shown in bold:
url@javax.sql.BaseDataSource=jdbc:mysql://127.0.0.1:3306/sakai290?useUnicode=true&characterEncoding=UTF-8
Save the changes
Install Sakai master project
Run the following commands:
cd /opt/sakai-2.9.2/master
mvn clean install
Install and deploy Sakai
cd /opt/sakai-2.9.2/
mvn clean install sakai:deploy -Dmaven.tomcat.home=/opt/tomcat -Dsakai.home=/opt/tomcat/sakai/
NB: Your first Sakai build will take some time as Maven downloads and stocks your local .m2/repositorywith missing dependencies while performing the build and deploying .warand .jar files to Tomcat’s$CATALINA_HOME/webapps, $CATALINA_HOME/components and $CATALINA_HOME/shared/lib folders. If during this process Maven reports that the build failed read the accompanying error message carefully to troubleshoot the issue (see the [Troubleshooting] section).
Restart tomcat
sh /opt/tomcat/bin/shutdown.sh
sh /opt/tomcat/bin/startup.sh
STEP 10: Access the New Sakai installation
The default sakai username and password is admin