Sunday, April 05, 2009

LAMS 2.2 install on CentOS 5.2

As part of an ongoing investigation into elearning methods we are setting up a new CentOS 5.2 server running Moodle, DSpace and LAMS.

Currently the CentOS 5.2 server has installed:


1) Moodle 1.9 install

Moodle 1.9 is now sucessfully up and running on the new server.

Installation was relatively straightforward. The main problem I encountered with the Moodle install was that when I visited the admin page (index.php) at the end of the installation process it just produced a blank screen. It turned out that PHP5 installed with CentOS 5 did not include MySQL support!

This was solved as follows:

yum install php-mysql
service httpd restart

The index.php script ran happily after this

Also Moodle Admin > Environment came up with a couple of recommendations so I installed php-xmlrpc and php-mbstring as follows:

yum install php-xmlrpc
yum install php-mbstring
service httpd restart

2) LAMS 2.2 install

The process followed so far has been:

Edit the file /etc/my.cnf and add the READ-COMMITTED parameter as shown:

transaction-isolation = READ-COMMITTED

Restart mysql using the folowing command:

service mysqld restart

Install phpMyAdmin using cookie authentication.

As root, and in the root users home directory, download the JDK from Sun and install it using the following commands:

chmod 755 jdk-6u13-linux-i586-rpm.bin\&File\=jdk-6u13-linux-i586-rpm.bin

Edit /etc/profile and set the JAVA_HOME variable as follows:

export JAVA_HOME
export PATH

Change the symlink for Java to point to the new location:

rm /usr/bin/java
ln -siv /usr/java/jdk1.6.0_13/bin/java /usr/bin/java

The java -version command will now produce the following output:

java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Server VM (build 11.3-b02, mixed mode)

Download and install Wildfire 2.6.2 into the root users home directory:

Wildfire can be downloaded from

rpm -ivh wildfire_2_6_2.rpm
rpm -q wildfire

The configuration of the Wildfire server is covered later in this blog posting.

As root, and in the root users home directory, download jboss using lynx and unpack jboss:

cp jboss-4.0.2.tar.gz /usr/local
cd /usr/local
tar -xzvf jboss-4.0.2.tar.gz

Edit /etc/profile and set the JBOSS_HOME variable as follows:


Now test jboss is working:

cd jboss-4.0.2
cd bin
./ &

Many screens of information appear as jboss starts and eventually the following line is displayed:

10:03:41,943 INFO [Server] JBoss (MX MicroKernel) [4.0.2 (build: CVSTag=JBoss_4_0_2 date=200505022023)] Started in 16s:278ms

Use the following commands to confirm jboss is running:


Starting Nmap 4.11 ( ) at 2009-04-05 10:05 BST
Interesting ports on localhost.localdomain (
Not shown: 1672 closed ports
25/tcp open smtp
80/tcp open http
443/tcp open https
631/tcp open ipp
3306/tcp open mysql
4444/tcp open krb524
8009/tcp open ajp13
8080/tcp open http-proxy

ps aux | grep jdk
root 15109 98.3 1.3 317272 106448 pts/1 Sl 10:09 0:20 /usr/java/jdk1.6.0_13/bin/java -server -Xms128m -Xmx128m -Djava.endorsed.dirs=/usr/local/jboss-4.0.2/lib/endorsed -classpath /usr/local/jboss-4.0.2/bin/run.jar:/usr/java/jdk1.6.0_13/lib/tools.jar org.jboss.Main

Stop jboss:

./ -S

As root, and in the root users home directory, download LAMS using lynx and unpack the installer:

tar -xxvf lams-unix-installer-2.2.tar.gz
cd lams-unix-installer-2.2

Note: The file contains the installation settings for LAMS. It is important you get the settings in this file right. If you subsequently change and re-run the installer you will overwrite your existing LAMS installation. Once LAMS has been installed all subsequent configuration changes must be made from and Admin login and not by editing

Edit the file and change the following settings (in bold):

# Installation Options

# The lamshome directory, will contain repository, temp and dump files
# Make sure this location has sufficient disk space as several files will be stored
# here during run time

# Username and password for the system admin for LAMS

# Default language locale and text direction for LAMS, see section 3 of the readme
# Note that for English the ONLY choice supported by LAMS is en_AU

# Database name, username and password for your LAMS database

# Wildfire configuration, used for chat tools. see the documentation under
# "Configuring the Chat Server" at:
# Make up a wildfire admin password
# Make a note of these settings as you will need them when configuring Wildfire later


# Essential settings

# The port through which you want jboss to run

# The url you intend to use to run LAMS
# NOTE: Make sure the URL ends with a "/" or you will have problems running LAMS

# Where your home directory of JBoss is
# This will contain your LAMS installation

# The directory that contains your JDK. (Must be 1.5 or higher)

# The location of your mysql executable (Must be 5.0 or higher)

# The location of your MySql server, leave as localhost unless you are useing MySql on
# a separate server

# The port that your MySql server is running through

# The URL that your jdbc driver will be running through

# The root password to access the database

Run the lams unix installer script as follows:


JDK_DIR is valid
MySql host is compatible with LAMS.
JBoss Directory Found


WELCOME to the LAMS 2.2 unix Installer!

Please ensure you have read and accepted the license agreement before continuing

Make sure you have correctly configured the file to your
preferred settings.

You should read the installation guide before continuing.

JAVA_HOME = /usr/java/jdk1.6.0_13


LAMS requires about 117MB of space, continue with installation? (y)es, (n)o: y


Do you wish to install LAMS as a Java Service Wrapper? (y)es, (n)o, (q)uit: y

The installer could not detect a suitable wrapper, please select one from below.
(1) wrapper-linux-x86-32-3.2.3
(2) wrapper-linux-x86-64-3.2.3
(3) wrapper-linux-ppc-64-3.2.3
(n) No wrapper, continue with install
(q) quit
> 1

Using LAMS database with the following parameters...
Database name: lams2
Database user: lamsuser
Database password: xxxx

Creating LAMS database.
Buildfile: ant-scripts/configure-database.xml
Database Created.

Filling database with LAMS tables

Buildfile: ant-scripts/filter-config.xml
Buildfile: ant-scripts/configure-database.xml


Database Created.

Copying lams.ear directory to /usr/local/jboss-4.0.2/server/default/deploy.


Configuring JBoss with your settings.
Buildfile: ant-scripts/configure-deploy.xml

Configuring the java Wrapper

Installing and configuring Java Service Wrapper: wrapper-linux-x86-32-3.2.3
Buildfile: ant-scripts/configure-deploy.xml

Copying to /etc.

LAMS 2.2 Configuration completed!
Please view the README for instructions on how to run LAMS.

Getting Apache to talk to JBoss

I decided to use mod_jk instead of the deprecated mod_jk2 to link Apache and JBoss together.

As root, and in the root users home directory, download the source for mod_jk using lynx, compile and install the module:

tar -xzvf jakarta-tomcat-connectors-1.2.15-src.tar.gz
cd jakarta-tomcat-connectors-1.2.15-src
cd jk/native
yum install httpd-devel
./configure --with-apxs=/usr/sbin/apxs
cp /root/jakarta-tomcat-connectors-1.2.15-src/jk/native/apache-2.0/ /usr/lib/httpd/modules

Now create the following files:
cd /etc/httpd/conf
Create the file containing the following:


cd /etc/httpd/conf.d
Create the file jk.conf containing the following:

# Mod_jk2 allows the Apache Web server to connect to application
# servers using the AJP protocol. This allows web applications to
# be integrated seamlessly into your Apache server's URI space and
# utilize Apache features such as SSL processing.

LoadModule jk_module modules/

# mod_jk is configured in /etc/httpd/conf/

# Where to find
JkWorkersFile /etc/httpd/conf/
# Where to put jk logs
JkLogFile /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Send servlet for context /lams to worker named worker1
JkMount /lams worker1
# Send JSPs for context /lams/* to worker named worker1
JkMount /lams/* worker1
JkMount /upload/* worker1
JkMount /jmx-console/* worker1

Now to start LAMS:

service lams2 start
Starting LAMS...

ps aux | grep jdk
root 20297 87.2 6.2 961780 515220 ? Sl 07:09 2:28 /usr/java/jdk1.6.0_13/bin/java -XX:MaxPermSize=256m -Xms246m -Xmx512m -Djava.library.path=../lib -classpath ../lib/wrapper.jar:../bin/run.jar:/usr/java/jdk1.6.0_13/lib/tools.jar -Dwrapper.key=9PVMzuBXkSSobgBc -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.version=3.2.3 -Dwrapper.native_library=wrapper -Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp org.jboss.Main


Starting Nmap 4.11 ( ) at 2009-04-06 07:13 BST
Interesting ports on localhost.localdomain (
Not shown: 1672 closed ports
25/tcp open smtp
80/tcp open http
443/tcp open https
631/tcp open ipp
3306/tcp open mysql
4444/tcp open krb524
8009/tcp open ajp13
8080/tcp open http-proxy

Hurray LAMS is now running. :)))

It is also accessible on port 80 of the server.

According to Luke Foxton (Macquarie University) when you choose to install with the wrapper, the installer alters the script so it will work with the wrapper, with the idea being that once installed, the wrapper will automatically restart lams when the system reboots. However, this means that you can no longer use the script to start lams directly.

The Wildfire chat server can be configured from a Web interface once it is running.

cd /opt/wildfire/bin
wildfire start
nano /etc/rc.d/rc.local
and append the following line

/opt/wildfire/bin/wildfire start

If you intend to use an external database for Wildfire you will at this point need to set up a wildfire database in MySQL, with a user who has appropriate privileges.

Then visit from your browser to complete the configuration. Note that you will need to use the Wildfire settings from here.

3) Moodle - LAMS integration

Please note that it is necessary to retain the LAMS v1 module that came with Moodle and just keep it hidden. I deleted this module, not thinking I would need it and then found that with a LAMS v2 activity the buttons, Open Authoring and Add a New Lesson, were missing for Course Creators and Teachers. On re-installing the LAMS v1 module and keeping it hidden these buttons reappeared!

Download and install the lamstwo module:

cd /home/ictuser/moodle/mod
mv lamstwo.php /home/ictuser/moodle/lang/en_utf8/

Then login to LAMS as administrator and go to Sys Admin > Maintain Integrated Servers
> Add a New Server

Fill in the fields in the form paying particular attention to the ID, Key and User Information URL fields. My user information field contained the following string:

Save your changes and then visit the Moodle admin page at which point the new tables for the lamstwo module will be added to the database. Visit the Modules > Activities > LAMSv2 page and fill in the settings.

Click on the validate button and if all is well you will get the following message "These settings are valid". This means that Moodle can talk to LAMS and LAMS can talk to Moodle.

In my case validation failed and it was only with the help of Jun-Dir and some painstaking research on my part that I found out that the cause of the failure was an extra blank line at the end of Moodle's config.php script outside the closing PHP tag!