<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<rss version="2.0">
<channel>
<title>Serensoft FAQ - The five questions posted most recently:</title>
<description>Here Serensoft answers your frequently-asked questions</description>
<link>http://faq.serensoft.com</link>	<item>
		<title><![CDATA[What is star schema grouping?]]></title>
		<description><![CDATA[
<p>A star schema grouping is an arrangement of database tables where you have a fact table in "the center", and many dimension tables linking directly to it. For example, a student-course-load fact table might be measured by dimensions such as semester, date, department, student home state, and so on.</p><p>The tricky part comes when you have several different fact tables that share dimensions. For example your student-course-load fact and your grades fact, plus even your student-head-count fact, can all be measured by semester and by department.</p><p>The main thing is to make sure you roll up your summaries to the same level of granularity. That is, if you're summarizing head-count by division, then you should also roll up course-load by division, in the same query. Otherwise you'll be double-counting all kinds of stuff.</p>
]]></description>
		<link>http://faq.serensoft.com/index.php?action=artikel&amp;cat=4&amp;id=48&amp;artlang=en</link>
		<pubDate>Tue, 16 Nov 2010 12:54:13 GMT</pubDate>
	</item>
	<item>
		<title><![CDATA[Installing OSP/Sakai v2.3]]></title>
		<description><![CDATA[
<div class="faq">
<blockquote style="border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(255, 204, 0); border-right-color: rgb(255, 204, 0); border-bottom-color: rgb(255, 204, 0); border-left-color: rgb(255, 204, 0); padding-top: 1em; padding-right: 1em; padding-bottom: 1em; padding-left: 1em; background-image: none; background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 204); background-position: 0% 50%; background-repeat: repeat repeat; "><p>NOTE: for a more up-to-date step-by-step guide on installing a modern Sakai these days, check out the official <a href="http://confluence.sakaiproject.org/confluence/x/zzs" title="http://bugs.sakaiproject.org/confluence/display/BOOT/Development+Environment+Setup+Walkthrough">Development Environment Setup Walkthrough</a> at the Sakai Confluence site. In particular, Sakai version 2.5.x and beyond all use Maven 2 ("mvn"). Sakai 2.4.x and older versions of Sakai use Maven 1 ("maven"). Also, the JDK compatibility package mentioned below is no longer required for recent versions of Sakai. </p><p>Still, you may still find the HOWTO here helpful, as it includes newbie-friendly rationale and context not found in the official version (plus, we're told that our writing is a bit different from most, in that it's "written in English, for humans" -- we hear that a lot).</p></blockquote>
<p>Sakai is an open-source <b>CLE </b>(collaborative learning environment) or <b>LMS </b>(learning management system) similar to Blackboard, but without the licensing headaches. OSP is an <b>electronic portfolio</b> toolkit built into Sakai -- so, once you install Sakai, you've got an electronic portfolio system ready to roll! Here's how you can get it running as a sandbox so you can learn more about what it can do--</p><h3>Prerequisites:
</h3><p>To get SAKAI/OSP running, you'll need:</p><ul><li>Java Developer Kit, or "JDK" for short (Sakai and OSP are written in Java)</li><li>Maven (this builds the system)</li><li>Tomcat (it serves up the web pages)</li><li>Subversion, or "svn" for short (it pulls the source code from sakaiproject.org)</li><li>Mysql (somewhere to store all the data)</li><li>and, of course, Sakai itself</li></ul><p>Note that versions change when patches are applied and bugs are fixed, so we'll try to avoid version-specific info when possible. For the exact versions we're using as we write this (January 2007) see footnotes at the very bottom.</p><hr width="100%" size="2" /><p>Ready?</p><h4>Java:</h4><p>We download the "netbeans" version. Don't be surprised if this part of your experience is confusing -- which link to follow? You're not alone (Java is for programmers, don't forget, so they build the website for a clientele different from normal mortals)...</p><p>Here's the most generic path to a healthy JDK that we could find -- instad of giving you a final URL which could change weekly, here's a conceptual path to get to the stuff you need (and the website may change too, of course, but they're likely to keep the general idea the same):</p><ol><li>Visit <a title="Sun.com's Java" href="http://java.sun.com/">http://java.sun.com/</a> -- now, if you think you can 1) where to go and 2) which one is the right download for you, feel free and dive right in! We find that there are enough varieties and versions to select among that it's easy to get lost, so:</li><li>Click "Downloads":<br /><img src="http://faq.serensoft.com/images/java_com.png" /></li><li>Click "Java SE":<br /><img src="http://faq.serensoft.com/images/java_downloads.png" /></li><li>Click "Get the JDK download" line:<br /><img src="http://faq.serensoft.com/images/jdk_link.png" /></li><li>Check out the license agreement and click "Accept" -- though it looks
like you can skip this part and go straight to your download, that
won't work! :)<br /><img src="http://faq.serensoft.com/images/java_license.png" /></li><li>Pick the instance appropriate for your platform (we use Debian/GNU Linux) and click it to start your download:<ul><li>Linux</li><li>Solaris SPARC</li><li>Solaris x86</li><li>Windows</li></ul>For Linux, we use the non-rpm *.bin style.</li></ol><p>Now that we've got it downloaded, we plop it into /usr/local:</p><pre># <b><font color="#006666">ls -lF /usr/local</font></b><br />total 48460<br />drwxrwsr-x   2 root    staff     4096 Jun 30 18:14 bin/<br />drwxrwsr-x   2 root    staff     4096 Nov 18  2005 games/<br />drwxrwsr-x   2 root    staff     4096 Nov 18  2005 include/<br />-rw-r--r--   1 root    staff 49518537 Oct 25 16:21 jdk-***-linux-***.bin<br />drwxrwsr-x   5 root    staff     4096 Mar 22  2006 lib/<br />lrwxrwxrwx   1 root    staff        9 Nov 18  2005 man -&gt; share/man/<br />drwxrwsr-x   2 root    staff     4096 Nov 18  2005 sbin/<br />drwxrwsr-x   6 root    staff     4096 Mar 22  2006 share/<br />drwxrwsr-x   2 root    staff     4096 Nov 18  2005 src/</pre><p>(Instead of a specific version number above we're showing asterisks -- when you get around to doing these steps you're likely to wind up with a more modern instance than what we just downloaded, so we're trying to keep this very generic.) And there, we "run" it (after all it's just a shell script):</p><pre># <b><font color="#006666">sh jdk*bin</font></b></pre><p>It'll ask for you to agree to the licencing scheme again, and once you do it'll decompress everything in no time.</p><p>Now you'll have a new directory:</p><pre>drwxr-xr-x   9 root    staff     4096 Oct 12 15:01 jdk1.*/</pre><p>This is your java home! (Again, we're generifying the version numbers since they're ephemeral.) For convenience, we make a generic "java" symbolic link to refer to our new java home:</p><pre># <b><font color="#006666">ln -s jdk1.* java</font></b><br /># <b><font color="#006666">ls -ldF j*</font></b>
lrwxrwxrwx  1 root staff       11 Oct 25 16:41 java -&gt; jdk1.*/
-rw-r--r--  1 root staff 49518537 Oct 25 16:21 jdk-***-linux-***.bin
drwxr-xr-x  9 root staff     4096 Oct 12 15:01 jdk1.*/
</pre><p>So now when we refer to <b>/usr/local/java</b> we're really referring to the instance we unfolded into the jdk1.*/ directory. And if we ever need to install an update, we do so and then just point the "java" symlink to the new directory. Neat!</p><hr width="100%" size="2" /><h4>Maven:</h4><p>Here, the specific VERSION is actually important -- Maven 1.0.2 is what Sakai expects, <a title="Sakai Install: Maven" href="http://bugs.sakaiproject.org/confluence/display/DOC/Set+up+Build+Environment#SetupBuildEnvironment-imaven">until further notice</a>. If you look at the Apache website you'll see that Maven is already past version 2.0... but the Sakai architects haven't given the "green light" to that one yet [NOTE: Maven 2.0 <b>is required</b> for 2.5.x and beyond, but this install-howto is for version 2.3.x] so stick with 1.0.2 for now. So here we go:</p><ol><li>Browse to <a title="Apache Maven v1.x" href="http://maven.apache.org/maven-1.x/">http://maven.apache.org/maven-1.x/</a> making sure you're NOT looking at version 2.x!</li><li>Click "Download"<br /><img src="http://faq.serensoft.com/images/maven_download.png" /></li><li>Choose the <b>Maven 1.0.2 version</b> appropriate for your platform:<br /><img src="http://faq.serensoft.com/images/maven_platform.png" /><br />Only version 1.0.2, remember! For Debian/GNU Linux, we use ".tar.gz".</li><li>Clicking the link there will take you to a list-of-mirrors, and THAT is where you download the actual file. (If you download the above link and try to unzip it, you won't get very far since it's really just an HTML page.)</li></ol><p>Once we have it downloaded we move it to /usr/local:</p><pre># <font color="#006666"><b>cd /usr/local</b></font><br /># <font color="#006666"><b>ls -lF maven*</b></font><br />-rw-r--r--  1 root staff 20092 Oct 25 20:46 maven-1.0.2.tar.gz</pre><pre>And now we unzip it:</pre><pre># <font color="#006666"><b>tar zxf maven-1.0.2.tar.gz</b><b></b></font><br /># <b><font color="#006666">ls -ldF mav*</font></b><br />drwxr-xr-x  5 root root     4096 Dec  7  2004 maven-1.0.2/<br />-rw-r--r--  1 root staff 6060686 Dec  7  2004 maven-1.0.2.tar.gz</pre><p>Now we do our "symlink" trick again:</p><pre># <font color="#006666"><b>ln -s maven-1.0.2 maven</b></font><br /># <b><font color="#006666">ls -ldF mav*</font></b><br />lrwxrwxrwx  1 root staff      11 Oct 27 11:11 maven -&gt; maven-1.0.2/<br />drwxr-xr-x  5 root root     4096 Dec  7  2004 maven-1.0.2/<br />-rw-r--r--  1 root staff 6060686 Dec  7  2004 maven-1.0.2.tar.gz</pre><hr width="100%" size="2" /><p>Now for our web server--</p><h4>Tomcat:</h4><p>There are TWO downloads to make here: one is Tomcat itself, the other is the JDK compatibility package.</p><ol><li>Visit <a href="http://tomcat.apache.org/" title="Apache Tomcat">http://tomcat.apache.org/</a></li><li>Click "Tomcat 5.x" under "Download":<br /><img src="http://faq.serensoft.com/images/tomcat_version.png" /></li><li>Download the appropriate "Core" instance for your platform -- for Debian/GNU Linux we use ".tar.gz":<br /><img src="http://faq.serensoft.com/images/tomcat_core.png" /></li><li>ALSO download the JDK compatibility package as well:<br /><img src="http://faq.serensoft.com/images/tomcat_compat.png" /><br /> </li></ol><p>First, move the Tomcat archive to /usr/local and unfold it there -- and make a symlink to it:</p><pre># <b><font color="#006666">tar xfz apache-tomcat*</font></b><br /># <font color="#006666"><b>ln -s apache-tomcat-*** tomcat</b></font><br /># <b><font color="#006666">ls -ldF *tomcat*</font></b><br />drwxr-sr-x  11 root staff    4096 Oct 27 15:33 apache-tomcat-*/<br />-rw-r--r--   1 root staff 5949295 Sep 28 09:01 apache-tomcat-*.gz<br />lrwxrwxrwx   1 root staff      20 Oct 27 15:33 tomcat -&gt; apache-tomcat-*/</pre><p>(Note we're leaving out the version-number specifics again -- just make sure you're using the latest <i>version 5</i> tomcat.)</p><p>Now move the JDK-compat package to /usr/local and unfold it right on top of your new Tomcat setup (it adds bin/jmx.jar, common/endorsed/xercesImpl.jar and common/endorsed/xml-apis.jar):</p><pre># <font color="#006666"><b>tar xfz apache-tomcat-***-compat.tar.gz</b></font><br /># <b><font color="#006666">ls -ldF *tomcat*</font></b><br />drwxr-sr-x  11 root staff    4096 Oct 27 15:50 apache-tomcat-*/<br />-rw-r--r--   1 root staff 1624224 Sep 28 09:01 apache-tomcat-*-compat.tar.gz<br />-rw-r--r--   1 root staff 5949295 Sep 28 09:01 apache-tomcat-*.tar.gz<br />lrwxrwxrwx   1 root staff      20 Oct 27 15:53 tomcat -&gt; apache-tomcat-*/</pre>So far so good! Now for a little configuration--<p>Edit <b>tomcat/conf/server.xml</b> and look for port="8080" to find this snippet:</p><pre>    &lt;Connector port="8080" maxHttpHeaderSize="8192"<br />               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"<br />               enableLookups="false" redirectPort="8443" acceptCount="100"<br />               connectionTimeout="20000" disableUploadTimeout="true" /&gt;</pre><p>We need to add a URIencoding attribute there:</p><pre>    &lt;Connector port="8080" maxHttpHeaderSize="8192"<br />               <font color="#006666"><b>URIEncoding="UTF-8"</b></font><br />               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"<br />               enableLookups="false" redirectPort="8443" acceptCount="100"<br />               connectionTimeout="20000" disableUploadTimeout="true" /&gt;</pre><p>Nothing to it! Now, we'll make life a little easier for casual browsers by giving them a default redirect: they'll be able to browse to http://your.server:8080 and this will redirect them to your OSP portal [which is being deprecated in version 2.5.x and beyond] instead of showing a default Tomcat page:</p><pre class="screen"># <font color="#006666"><b>cat &gt; tomcat/webapps/ROOT/index.html</b><br />&lt;html&gt;<br />    &lt;head&gt;<br />        &lt;meta http-equiv="refresh" content="0;url=/osp-portal"&gt;<br />        &lt;title&gt;Redirecting to /osp-portal&lt;/title&gt;<br />    &lt;/head&gt;<br />    &lt;body&gt;serving up &lt;a href="/osp-portal"&gt;/osp-portal&lt;/a&gt; instead...&lt;/body&gt;<br />&lt;/html&gt;<br />^D</font></pre>End with control-D to close and finish the file. Tomcat should be ready to rumble!<br /><p /><hr width="100%" size="2" /><h4>Subversion:</h4><p>You may have noticed that we use Debian/GNU Linux -- and here's why:</p><pre># <font color="#006666"><b>apt-get update</b></font><br /># <b><font color="#006666">apt-get install subversion</font></b></pre><p>And to keep everything up-to-date, we just do:</p><pre># <font color="#006666"><b>apt-get upgrade</b></font></pre><p>Big chore, eh? Next!</p><p>Unfortunately, Debian's Tomcat is a version behind, and Maven isn't even available as a Debian package. Zut alors!</p><hr width="100%" size="2" /><h4>Mysql:</h4><p>Again, using Debian, we can get MySql running in a jiffy:</p><pre># <font color="#006666"><b>apt-get update</b></font><br /># <b><font color="#006666">apt-get install mysql-client-4.1 mysql-server-4.1</font></b></pre><p>Nothing to it!</p><p>Another nice aspect of dealing with Debian is that "unstable" to the debian community matches what many other folks would consider "rock solid". There are mission-critical servers running Debian "unstable" for years on end without a blip!</p><p>Note that we still don't have an actual Sakai database yet -- that will come soon enough...</p><p>We also need a java library to hook up your Java to your MySql (strangely enough, it's called the JDBC MySql connector):</p><ol><li>Browse to <a title="JDBC connector v3 for MySql" href="http://dev.mysql.com/downloads/connector/j/3.1.html">http://dev.mysql.com/downloads/connector/j/3.1.html</a></li><li>Download the latest version-3 connector (version 5 isn't fully endorsed)</li><li><p>Unfold it so you can get to the *.jar file:</p><pre>$ <b><font color="#006666">tar xfz mysql*tar.gz</font></b><br />$ <b><font color="#006666">ls -ld mysql*</font></b><br />drwxr-xr-x  5 sakai sakai     4096 Oct 18 16:35 mysql-connector-java-3.1.*/<br />-rw-r--r--  1 sakai sakai 28936239 Oct 31 14:21 mysql-connector-java-3.1.*.tar.gz<br />$ <b><font color="#006666">ls -l mysql*/*jar</font></b><br />-rw-r--r--  1 sakai sakai 459094 Oct 18 16:35 mysql-connector-java-3.1.14/mysql-connector-java-3.1.*-bin.jar</pre></li><li><p>Plop the *.jar file into common/lib:</p><pre>$ <b><font color="#006666">cp mysql*/*.jar /usr/local/tomcat/common/lib/</font></b></pre></li></ol><p>Without that, Tomcat would NOT be able to communicate with MySql.</p><p>On with the configuring!</p><hr width="100%" size="2" /><h4>Variables, Preparations and other Settings:</h4><p>Okay. Before we do anything else, we'll create a "sakai" shell user and make sure permissions on /usr/local/tomcat are properly set:</p><pre># <font color="#006666"><b>useradd sakai</b><font color="#000000"><br /># <font color="#006666"><b>chown -R sakai:sakai /usr/local/tomcat/*</b></font><br /># <font color="#006666"><b>su - </b></font></font><b>sakai</b></font></pre><p>The home directory of user "sakai" is where the source code and settings will be for building Sakai/OSP. And when user "sakai" builds and deploys the sakai system, it'll wind up in /usr/local/tomcat.</p><p>You should set some environmental variables: do these "live" on your command line so you can test them, but also put them in a shell script that you can source at any time (including from ~sakai/.bashrc) so they'll be "permanent".</p><p>First, SAKAI_HOME is ~sakai:</p><pre>$ <font color="#006666"><b>export SAKAI_HOME=/home/sakai</b></font></pre><p>Next, where's java? It's in $JAVA_HOME:</p><p /><pre>$ <b><font color="#006666">export JAVA_HOME=/usr/local/java</font></b><br />$ <font color="#006666"><b>ls -l $JAVA_HOME</b></font><br />lrwxrwxrwx  1 root staff 11 Oct 25 16:41 /usr/local/java -&gt; jdk1.5***</pre><p /><p>So now $JAVA_HOME refers to our /usr/local/java symlink. And Java itself can be found in $JAVA_HOME/bin/java. Easy!</p><p>Now for $MAVEN_HOME:</p>
<pre>$ <b><font color="#006666">export MAVEN_HOME=/usr/local/maven</font></b></pre>
<p>Now add the appropriate BIN directories to your $PATH (in your .bashrc so it's permanent) and then test to make sure everything is all set up:</p><pre>$ <font color="#006666"><b>export PATH="$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin"</b></font><br />$ <font color="#006666"><b>java -version</b></font><br />java version "1.5***"<br />Java(TM) 2 Runtime Environment, Standard Edition (build 1.5***)<br />Java HotSpot(TM) Client VM (build 1.5***, mixed mode, sharing)<br />$ <font color="#006666"><b>maven -v</b></font><br /> __  __<br />|  /  |__ _Apache__ ___<br />| |/| / _`  V / -_) '   ~ intelligent projects ~<br />|_|  |___,_|_/___|_||_|  v. 1.0.2</pre><p>Piece of cake!</p><p>For Tomcat, the environmental variable is, for historical purposes,
$CATALINA_HOME -- we set the variable (in .bashrc, of course) and then
test it:</p><pre>$ <font color="#006666"><b>export CATALINA_HOME=/usr/local/tomcat</b></font><br />$ <b><font color="#006666">sh $CATALIA_HOME/bin/version.sh</font></b><br />Using CATALINA_BASE:   /usr/local/tomcat<br />Using CATALINA_HOME:   /usr/local/tomcat<br />Using CATALINA_TMPDIR: /usr/local/tomcat/temp<br />Using JRE_HOME:       /usr/local/java<br />Server version: Apache Tomcat/***<br />Server built:   ***<br />Server number:  ***<br />OS Name:        Linux<br />OS Version:     ***<br />Architecture:   ***<br />JVM Version:    ***<br />JVM Vendor:     Sun Microsystems Inc.</pre><p>To be specific, we create a script called "~sakai/variables.sh" and it contains:</p><pre><font color="#006666">#!/bin/sh<br />export SAKAI_HOME=/home/sakai<br />export JAVA_HOME=/usr/local/java<br />export MAVEN_HOME=/usr/local/maven<br />export CATALINA_HOME=/usr/local/tomcat<br />export PATH="$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin"<br />export JAVA_OPTS="</font></pre><p>Your ~/.bashrc should 'source' that file, and so could any other script -- which is useful, as we'll soon see.</p><p>Now let's get MAVEN ready: create a file "build.properties" to point to your tomcat directory and indicate the remote sakai repository:</p><pre>$ <font color="#006666"><b>cat &gt; build.properties</b><br />maven.repo.remote=http://source.sakaiproject.org/maven/<br />maven.tomcat.home=/usr/local/tomcat/<br />^D</font></pre><p>End "cat" with control-D (and note that /usr/local/tomcat is the tomcat-specific symlink we established a while back). Now, initialize your MAVEN repository:</p><pre>$ <font color="#006666"><b>$MAVEN_HOME/bin/install_repo.sh ~/.maven</b></font><br />$ <font color="#006666"><b>ls -lF ~/.maven</b></font><br />drwxr-xr-x   3 sakai sakai 4096 Oct 27 17:57 ant/<br />drwxr-xr-x   3 sakai sakai 4096 Oct 27 17:57 commons-beanutils/<br />drwxr-xr-x   3 sakai sakai 4096 Oct 27 17:57 commons-betwixt/<br />drwxr-xr-x   3 sakai sakai 4096 Oct 27 17:57 commons-cli/<br />[yada yada, snip snip]</pre><p>A walk in the park! Now for the important stuff--</p><hr width="100%" size="2" /><h4>Download, Build, Deploy:</h4><p>Now you're ready to get started with the meat of the project -- and this is the part you can iterate over as you tweak your sakai instance (adding skins, for example):</p><pre>$ <font color="#006666"><b>svn export https://source.sakaiproject.org/svn/sakai/branches/sakai_2-3-x/</b></font></pre><p>This will take quite a while -- lots of stuff to download! -- so go catch up on email if you need to. The 2-3-x instance gets all the latest patches and fixes, so we use that instead of 2-3-0 or 2-3-9.</p><p>Subversion ("svn" for short) creates the "sakai_2-3-x" directory and populates it with all kinds of source stuff. Eventually. Now, another symlink:</p><pre>$ <b><font color="#006666">ln -s sakai_2-3-x sakai</font></b><br />$ <font color="#006666"><b>ls -ldF sakai*</b></font><br />lrwxrwxrwx   1 sakai sakai   11 Oct 27 18:42 sakai -&gt; sakai_2-3-x/<br />drwxr-xr-x  57 sakai sakai 4096 Oct 27 18:41 sakai_2-3-x/</pre><p>Now our sakai source files will be found at <b>~sakai/sakai/</b> because of our old friend, the symlink trick. Nice!</p><p>Here we go! [Maven 2, which is used for 2.5.x and beyond, has a different set of commands to use here, of course: <font face="courier new, courier, monospace">mvn clean install sakai:build</font>] If you build it, they will come!</p><pre>$ <font color="#006666"><b>maven sakai | tee maven-sakai-log</b></font><br />Starting the reactor...[snip]<br />BUILD SUCCESSFUL<br />Total time: 10 minutes 43 seconds<br />Finished at: Fri Oct 27 19:23:04 CDT 2006</pre><p>Using "maven sakai" is a nice shortcut for "maven cln bld dpl" which means "clean, build, deploy". It zaps old stuff (for the first instance here, there isn't any to zap, of course) and then rebuilds it, and deploys it into the tomcat directory (according to your build.properties file).</p><p>This command will take a LOOOONG time -- ten minutes, maybe more -- and generate copious output. (Thus it's good to use "tee" to keep a copy in case you want to look at it later.)</p><p>What BUILD does, is takes all the .../src/* stuff, and compiles it to their respective .../target/* destinations in preparation for deployment. DEPLOY moves it all to the live Tomcat directory. (And CLEAN zaps all the .../target/ directories.)</p><p>So -- now that Tomcat has everything it needs to serve up Sakai, we need to configure Sakai to our liking, and we also need a database for Sakai to work with...</p><hr width="100%" size="2" /><h3>Final Configuration:</h3><p>Two things remain: Sakai needs a database, and some configuration.</p><h4>Create the Sakai database</h4><p>As root, connect to MySql and:</p><pre>mysql&gt; <font color="#006666">create database <b>sakai_2_3_x</b> default character set utf8;</font><br />mysql&gt; <font color="#006666">grant all on <b>sakai_2_3_x</b>.* to <b>sakaiuser</b>@'localhost' identified by '<b>snarkySekrit</b>';</font><br />mysql&gt; <font color="#006666">grant all on <b>sakai_2_3_x</b>.* to <b>sakaiuser</b>@'127.0.0.1' identified by '<b>snarkySekrit</b>';</font></pre><p>Piece of cake! Just make sure you use your own settings for the bold stuff -- particularly a reasonable password, as opposed to cut-and-pasting our example here...</p><p>Now we need to make sure sakai.properties is all set up:</p><h4>Configuring sakai.properties</h4><p>If we're going to tell Sakai (tomcat) that SAKAI_HOME is ~sakai, that's where it expects to find <b>sakai.properties</b>. You'll notice that there isn't any such animal there, yet.</p><p>Fortunately there are several available in the source code you just downloaded via svn: the one we want is specifically OSP-savvy:</p><pre>$ <b><font color="#006666">mkdir $CATALINA_HOME/sakai</font></b><br />$ <b><font color="#006666">cp sakai/osp/overlay/component/component-api/component/src/config/org/sakaiproject/config/sakai.properties $CATALINA_HOME/sakai</font></b><br />$ <font color="#006666"><b>ln -s $CATALINA_HOME/sakai/sakai.properties ~/properties</b></font><br />$ <font color="#006666"><b>ln -s $CATALINA_HOME/logs/catalina.out ~/</b></font></pre><p>Now we have ~sakai/properties as a symlink to $CATALINA_HOME/sakai/sakai.properties and a shortcut to the catalina.out logfile as well.</p><p>The OSP instance is the one with /osp-portal instead of just /portal. (This is assuming your sakai symlink -- the one that points to the sakai-* source code you just downloaded via svn -- is in your current directory, of course.)</p><p>Now, edit your "~sakai/sakai.properties" file to ensure:</p><pre># set the hibernate dialect (for shared datasource), HSQLDB by default, mySql and Oracle examples<br /><font color="#006666">#hibernate.dialect=org.hibernate.dialect.HSQLDialect<br />hibernate.dialect=org.hibernate.dialect.MySQLDialect</font></pre><p>That is, disable (comment-out) HSQL, and enable MySQL instead. Also add:</p><pre><font color="#006666">vendor@org.sakaiproject.db.api.SqlService=mysql<br />driverClassName@javax.sql.BaseDataSource=com.mysql.jdbc.Driver<br />url@javax.sql.BaseDataSource=jdbc:mysql://localhost:3306/<b>sakai_2_2_x</b>?useUnicode=true&amp;characterEncoding=UTF-8<br />username@javax.sql.BaseDataSource=<b>sakaiuser</b><br />password@javax.sql.BaseDataSource=<b>snarkySekrit</b><br />validationQuery@javax.sql.BaseDataSource=select 1 from DUAL<br />defaultTransactionIsolationString@javax.sql.BaseDataSource=TRANSACTION_READ_COMMITTED</font></pre><p>Those are the parameters needed to tell Tomcat how to connect to the Sakai database; the bold stuff needs to be replaced by the strings you've used in your setup. (During the first connection, it'll create all the tables as needed. Nice!)</p><p>Also tweak the following, accordingly:</p><pre><font color="#006666">serverId=<b>serious.name.net</b><br />serverUrl=http://www.<b>serious.name.net</b>:8080<br />serverName=www.<b>serious.name.net</b><br />termyear.</font>*<br /><font color="#006666">termlistabbr.</font>*<br /><font color="#006666">termstarttime.</font>*<br /><font color="#006666">termendtime.</font>*</pre><p>Now we can create up.sh/down.sh scripts to launch and terminate Sakai:</p><pre><font color="#006666">#!/bin/sh<br />. ~sakai/variables.sh<br />$CATALINA_HOME/bin/startup.sh &amp;&amp; tail -f $CATALINA_HOME/logs/catalina.out</font></pre><p>That's "up.sh" and here's "down.sh":</p><pre><font color="#006666">#!/bin/sh<br />. ~sakai/variables.sh<br />$CATALINA_HOME/bin/shutdown.sh &amp;&amp; tail -f $CATALINA_HOME/logs/catalina.out</font></pre><p>Note that these scripts finish with "tail -f" which will show the log file contuously, as it grows... to get your command-line back, you can press ^C (control-C) any time.</p><pre>$ <b><font color="#006666">~/up.sh</font></b> <br />Using CATALINA_BASE:   /usr/local/tomcat<br />Using CATALINA_HOME:   /usr/local/tomcat<br />Using CATALINA_TMPDIR: /usr/local/tomcat/temp<br />Using JRE_HOME:       /usr/local/java<br />[snip]</pre><p>The first four lines should reflect some of your environment variable settings. And we're off to the races!</p><p>This will continue for QUITE A WHILE -- ten minutes or more, on the first run. Remember, it has to initialize the database as well!</p><p>If all goes well, you'll see LOTS of "INFO:" items fly by (and hopefully no ERROR or SEVERE). If you get to the point where the log shows:</p><pre><b>INFO: Server startup in 258168 ms</b></pre><p>Then you're up! To shut it down:</p><pre>$ <font color="#006666"><b>~/down.sh</b></font><br />[snip]<br /><b>INFO: Stopping Coyote HTTP/1.1 on http-8080</b>[snip]</pre><pre>When you see "Stopping Coyote" you're all finished!</pre><hr width="100%" size="2" /><h3>Versions (as of January 2007):</h3>Here are the specific versions we were working with above -- by the time you get to using these instructions, many will have been upgraded and the version numbers will have evolved accordingly...<br /><ul><li>Java: <i>jdk-1.5.0_10-linux-i586-rpm.bin</i></li><li>Maven: <i>maven-1.0.2</i><br /> </li><li>Tomcat: <i>apache-tomcat-5.5.20</i><br /> </li><li>Subversion: <i>1.1.4-2 (Debian Sarge)</i></li><li>MySql: <i>4.1.12 (Ubuntu universe)</i></li><li>Sakai/OSP: 2-3-x</li></ul></div>
]]></description>
		<link>http://faq.serensoft.com/index.php?action=artikel&amp;cat=20&amp;id=26&amp;artlang=en</link>
		<pubDate>Tue, 16 Nov 2010 12:50:38 GMT</pubDate>
	</item>
	<item>
		<title><![CDATA[Configuring Sakai/Tomcat for secure SSL over HTTPS]]></title>
		<description><![CDATA[
<div class="faq">
<blockquote style="border: 1px dotted silver; padding: 1em;">
<p>Previously this article had talked about getting Tomcat itself secured via a Keystore, and having Tomcat deal directly with the SSL traffic. Well, we've got a whole new paradigm now. :)</p>
</blockquote>

<p>So you've got Sakai up and running, and now you'd like to enable secure-sockets layer (SSL) so you can run it encrypted over HTTPS instead of plain-text HTTP...</p>

<p>No problem. First make sure you have Sakai <a href="index.php?action=artikel&cat=22&id=26&artlang=en">installed and configured</a>, and test it to make sure it works as expected via port 8080 in clear-text (http). Once that's confirmed to be working well, then you take the steps you'll need to secure it for https.</p><h3>Using APACHE to handle HTTPS traffic, with Tomcat backstage</h3>

<p>We've found that the most flexible way to do this is to <b>use Apache to handle the secure https:// traffic</b>, and have Mod_JK communicate with Tomcat (Using the "AJP13" protocol) behind the scenes. That is, Apache will handle all of the actual encrypted user interaction on port 443 -- Tomcat will only talk to Apache via AJP, and your users can't even get directly to Tomcat, only through Apache.</p>

<p>Here's what you will need, certificate-wise:</p>

<ul><li>A private key (certificate)</li>
<li>A certificate-signing request (CSR)</li>
<li>A certificate authority (CA) to sign the public key</li>
<li>A public key signed by the CA</li></ul>

<p>Note that you can be your own CA -- but your users' browsers will alert them to the fact that the certificate-authority that signed the certificate isn't a recognized one, and they should "proceed at their own risk, with extreme caution", and "don't complain if something odd happens because we're not responsible for you trespassing in these dangerous, murky waters"... warnings like that. If you pay a recognized CA to sign your certificate instead, they won't see any warnings at all and your users will have a nice, seamless experience as they browse securely.</p><p>You will also need the following components -- and if you use Debian or a Debian derivative such as Ubuntu, we've included the commands used to install them:</p>

<ul><li>Apache (<b>apt-get install apache2</b>)</li>
<li>Apache's Mod_SSL (<b>dpkg -S mod_ssl</b> indicates that 'apache2.2-common' supplies it, meaning that it comes with apache2)</li>
<li>Apache's Mod_JK (<b>apt-get install libapache2-mod-jk</b>, this is where the AJP protocol setup comes from)</li>
<li>OpenSSL (<b>apt-get install openssl</b>)</li></ul>

<h3>Creating your private and public keys/certificates:</h3>

<p>Ready? First set up your fully-qualified-domain-name and server-name:</p>

<pre style="color: rgb(0, 102, 102);">HOSTNAME=`hostname`<br />SERVER=`hostname | cut -f1 -d.`<br />mkdir sakai-cert<br />cd sakai-cert/</pre>

<p>So here $HOSTNAME should be something like "sakaisys.university.edu" and $SERVER is "sakaisys". Set yours according to your context! (Note that we will be using $HOSTNAME and $SERVER below instead of fixed strings, even when it's not possible to use the variable in a particular context.)</p>

<p>Next, generate your private key:</p>

<pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">openssl genrsa -des3 -out $SERVER.private.key 1024</b><br />Generating RSA private key, 1024 bit long modulus<br />.........................................++++++<br />....................................++++++<br />e is 65537 (0x10001)<br />Enter pass phrase for $SERVER.private.key: <b style="background-color: rgb(255, 255, 153);">pazwrd-goeth-here</b><br />Verifying - Enter pass phrase for $SERVER.private.key: <b style="background-color: rgb(255, 255, 153);">pazwrd-goeth-here</b></pre>

<p>If you want to remove the password on your private key, try this:</p>

<pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">openssl rsa -in $SERVER.private.key -out $SERVER.private.nopassword.key</b></pre>

<p>Now we do the hard part, creating a certificate-signing request (CSR). Here you give your geographical and structural information, and note in particular that <i>you must have your server's FQDN as the COMMON NAME!</i></p>

<pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">openssl req -new -key $SERVER.private.key -out $SERVER.csr</b><br />Enter pass phrase for sakaibb.private.key: <b style="background-color: rgb(255, 255, 153);">pazwrd-goeth-here</b><br />You are about to be asked to enter information that will be <br />incorporated into your certificate request.<br />What you are about to enter is what is called a Distinguished <br />Name or a DN.<br />There are quite a few fields but you can leave some blank<br />For some fields there will be a default value,<br />If you enter '.', the field will be left blank.<br />-----<br />Country Name (2 letter code) [AU]: <b style="background-color: rgb(255, 255, 153);">US</b><br />State or Province Name (full name) [Some-State]: <b style="background-color: rgb(255, 255, 153);">New Hampshire</b><br />Locality Name (eg, city) []: <b style="background-color: rgb(255, 255, 153);">Portsmouth</b><br />Organization Name (eg, company) [Internet Widgits Pty Ltd]: <b style="background-color: rgb(255, 255, 153);">Serensoft University</b><br />Organizational Unit Name (eg, section) []: <b style="background-color: rgb(255, 255, 153);">Information Technology</b><br />Common Name (eg, YOUR name) []: <b style="background-color: rgb(255, 153, 153);">sakaisys.university.edu</b><br />Email Address []: <b style="background-color: rgb(255, 255, 153);">helpdesk@university.edu</b><br /><br />Please enter the following 'extra' attributes<br />to be sent with your certificate request<br />A challenge password []:<br />An optional company name []:</pre>

<p>Again, just to be certain you're aware -- the COMMON NAME must be the fully-qualified domain name (FQDN) of your server. That's the value that was originally put into $HOSTNAME when we got started.</p>At this point you have a private key (<b>$SERVER.private.nopassword.key</b>) and a certificate-signing request (<b>$SERVER.csr</b>) to get signed. You can try <a href="http://www.google.com/search?q=self-signed+ssl+certificate+key+openssl" target="_blank" title="Google Self-Signed Certificate">signing it yourself</a>, or ship it off to a known/trusted certificate authority (CA) to get it signed officially. There's nothing wrong with creating your own CA and self-signing your certificates, but your users will get a warning saying that the certificate was signed by an unrecognized CA.<p>Once you get a signed public certificate (<b>$SERVER.public.key</b>) you might want to have a look and see what's in it. Here's how:</p>

<pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">openssl x509 -in $SERVER.public.key -text -noout</b></pre>

<p>Post your public and private keys where Apache can use them:</p>

<pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">cp $SERVER.public.key /etc/apache2/ssl/certs/</b><br /># <b style="background-color: rgb(255, 255, 153);">cp $SERVER.private.nopassword.key /etc/apache2/ssl/private/</b></pre>

<h3>Configure Apache, Mod_SSL and Mod_JK</h3>

<p>Apache will be handling all our web traffic, mod_ssl will encrypt it all for us, and mod_jk will pass off appropriate requests to Tomcat for handling by Sakai code.</p>

<p><b>1. Create a directory /var/www/$SERVER and put an empty "index.html" there.</b></p>

<p>You might also have a minimal "splash" page there instead, with a link to the https:// version of your Sakai instance.</p>

<p><b>2. Edit /etc/apache2/sites-available/$SERVER thus:</b></p><p>Note that this example shows a bare-bones setup. You can enhance your configuration to do what you please, but it's a good idea to start with a simple setup first, test it, and once you are confident that all is well, you can start adding tweaks later.</p><pre style="color: rgb(0, 102, 102);">&lt;VirtualHost *:80&gt;<br />        ServerName  <b>$HOSTNAME</b><br />        ServerAlias 192.168.123.234<br />        ServerAlias <b>$SERVER</b><br />        ServerAlias 127.0.0.1<br /><br />        #ServerAdmin webmaster@localhost<br /><br />        RedirectMatch ^/$         https://<b>$HOSTNAME</b>/portal<br />        RedirectMatch ^/(.+)      https://<b>$HOSTNAME</b>/$1<br />&lt;/VirtualHost&gt;</pre>

<p>So, for all HTTP requests, we redirect all traffic to the HTTPS secure port. (Instead of $HOSTNAME above you'll have your actual FQDN, and instead of $SERVER you'll have the node-name of your server, of course.) </p>

<p>Now for the SSL and JK (aka AJP) portions of our program:</p><pre style="color: rgb(0, 102, 102);">&lt;IfModule mod_ssl.c&gt;<br />JkWorkersFile <b>/etc/apache2/workers.properties</b><br />&lt;VirtualHost *:443&gt;<br />        ServerName  <b>$HOSTNAME</b>:443<br />        # ServerAlias -- not for HTTPS! wouldn't match the certificate<br /><br />        # Just in case:<br />        DocumentRoot /var/www/<b>$SERVER</b><br /><br />        # Servlet for context to worker named sakai, see workers.properties<br />        JkMount /* sakai<br />        JkUnmount /library/skin/* sakai<br />        JkUnmount /library/content/* sakai<br /><br />        Alias /library/skin    <b>/path/to/tomcat</b>/webapps/library/skin<br />        Alias /library/content <b>/path/to/tomcat</b>/webapps/library/content<br /><br />        #   SSL Engine Switch:<br />        #   Enable/Disable SSL for this virtual host.<br />        SSLEngine on<br />        SSLCertificateFile    /etc/ssl/certs/<b>$SERVER</b>.public.key<br />        SSLCertificateKeyFile /etc/ssl/private/<b>$SERVER</b>.private.nopassword.key<br /><br />&lt;/VirtualHost&gt;<br />&lt;/IfModule&gt;</pre>

<p>Both of the above &lt;VirtualHost&gt; snippets should be in the same /etc/apache2/sites-available/$SERVER config file.</p><p>Here if we don't have SSL (IfModule mod_ssl.c) we don't need to worry about mod_jk, and if we do have mod_ssl but we don't have mod_jk we'd rather have Apache break anyway, so we can fix it. You'll need to replace the BOLD items above with the items that make sense for your server, of course ("$SERVER" isn't valid inside Apache config files, for example -- you'll need to replace that with the real value for your server).</p>

<p>Note that we will have Tomcat handle most requests (<b>JkMount /* sakai</b>) but not the static items in /library/skin or /library/content (<b>JkUnmount ...</b>).</p><p><b>3. Edit /etc/apache2/workers.properties. </b></p><p>The above Apache configuration refers to /etc/apache2/workers.properties. That's what configures the core of the Tomcat AJP connector -- here is the <b>workers.properties</b> file in its entirety:</p>

<pre style="color: rgb(0, 102, 102);"># mod_jk config to connect apache to tomcat<br />workers.tomcat_home=/home/sakai/tomcat<br />workers.java_home=/usr/local/java<br />ps=/<br />worker.list=sakai<br /><br />worker.sakai.port=8009<br />worker.sakai.host=localhost<br />worker.sakai.type=ajp13<br />worker.sakai.lbfactor=1</pre><p>The first # line is just a comment in the file, not a command-line entry! What this does is tell Apache to connect to Tomcat using port 8009 on localhost.</p><p><b>4. Enable your virtual website</b></p><pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">a2ensite $SERVER</b></pre><p><b>5. Restart Apache:</b></p><pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">/etc/init.d/apache2 restart</b></pre>

<blockquote style="border: 1px dotted silver; padding: 1em;">
<p>Note that Apache can be restarted just about any old time -- it's just a conduit for traffic bound for Tomcat. Tomcat is where all the session information is stored. Restarting Apache might get a few of your users a quick "server not found" message, but a quick refresh will resume their session as if nothing happened.</p>

<p>Restarting Tomcat, on the other hand, <b>is</b> a big deal. Your users will be booted off and their sessions closed completely. Careful!</p>
</blockquote>

<h3>Configure Tomcat</h3>

<p>Finally, you must edit <tt>$CATALINA_HOME/conf/server.xml</tt> to make sure that the AJP connection is enabled on port 8009, and to turn off clear-text traffic on port 8080. The AJP connector should NOT be commented out:</p>

<pre style="color: rgb(0, 102, 102);">&lt;!-- Define an AJP 1.3 Connector on port 8009 --&gt; <br /><span style="background-color: rgb(255, 255, 153);">&lt;Connector port="8009" <br />       address="127.0.0.1"<br />       enableLookups="false" redirectPort="8443" protocol="AJP/1.3" /&gt;</span></pre>

<p>As shown above, you might also want to make sure you're asking Tomcat to look for connection on localhost (127.0.0.1) only, meaning it'll ignore your public-facing traffic, for even tighter security.</p>

<p>And the HTTP connector on port 8080 <u>should</u> be commented out:</p>

<pre style="color: rgb(0, 102, 102);">&lt;!-- Define a non-SSL HTTP/1.1 Connector on port 8080 --&gt;<br /><span style="background-color: rgb(255, 255, 153);">&lt;!--</span> &lt;Connector port="8080" maxHttpHeaderSize="8192"<br />...<br />/&gt; <span style="background-color: rgb(255, 255, 153);">--&gt;</span></pre>

<p>If you leave the port-8080 traffic open, folks might still keep on using it, and any network packet sniffer would be able to cull passwords and everything else! Better to lock it down.</p>

<p>Finally, restart Tomcat (after checking either A: to see that your users are off, or B: you're willing to suffer the consequences from those who aren't):</p>

<pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">$CATALINA_HOME/bin/shutdown.sh</b><br /># <b style="background-color: rgb(255, 255, 153);">tail -f $CATALINA_HOME/logs/catalina.out</b></pre>

<p>Once your Tomcat logs show "INFO main org.apache.coyote.http11.Http11BaseProtocol - Stopping Coyote HTTP/1.1 on http-8080" you can ^C to get out of "tail -f" and then start Sakai back up again:</p>

<pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">$CATALINA_HOME/bin/startup.sh</b><br /># <b style="background-color: rgb(255, 255, 153);">tail -f $CATALINA_HOME/logs/catalina.out</b></pre>

<p>
Watch for "INFO main org.apache.catalina.startup.Catalina - Server startup in #### ms" and then you're ready!

</p><p>You could easily configure Apache to listen on port 8080 and forward all requests to http://$HOSTNAME/portal as well.</p><p>Easy!</p></div>]]></description>
		<link>http://faq.serensoft.com/index.php?action=artikel&amp;cat=19&amp;id=62&amp;artlang=en</link>
		<pubDate>Thu, 01 Oct 2009 20:26:08 GMT</pubDate>
	</item>
</channel>
</rss>
