LAMS installation and configuration: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
(Adding LAMS 4 installation instructions)
(Added references to LAMS version 4.5, included default users, improve git instructions)
 
(2 intermediate revisions by the same user not shown)
Line 9: Line 9:
Note: I put the legacy stuff in the [[Talk:LAMS_installation_and_configuration|discussion page]], e.g. LAMS 2.x for Ubuntu, LAMS 2.1RC for Solaris
Note: I put the legacy stuff in the [[Talk:LAMS_installation_and_configuration|discussion page]], e.g. LAMS 2.x for Ubuntu, LAMS 2.1RC for Solaris


== LAMS 4.0+ ==
== LAMS 4.5+ ==
As of December 2019, LAMS 4.0 was released and is the latest stable release (as of March 2021).  
As of July 2021, LAMS 4.5 was released and is the latest stable release.  


=== Getting the LAMS source code ===
=== Getting the LAMS source code ===
Source code is available from [https://github.com/lamsfoundation/lams Github]. The code branch to use is v4.0
Source code is available from [https://github.com/lamsfoundation/lams Github]. The code branch to use is v4.5


'''Required software'''
'''Required software'''
Line 25: Line 25:
In Debian/Ubuntu 20.04
In Debian/Ubuntu 20.04


<code>$ sudo apt install openjdk-11-jdk-headless</code>
$ sudo apt install openjdk-11-jdk-headless
 
$ sudo apt install fontconfig
<code>$ sudo apt install fontconfig</code>
 
==== MySQL 8.0 DB ====
==== MySQL 8.0 DB ====
<code>$ wget <nowiki>https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb</nowiki></code>


<code>$ sudo dpkg -i  mysql-apt-config_0.8.15-1_all.deb</code>
$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb
$ sudo dpkg -i  mysql-apt-config_0.8.15-1_all.deb
$ sudo apt update
$ sudo apt install mysql-server
$ sudo mysql_secure_installation


<code>$ sudo apt update</code>
===== Basic MySQL configuration =====
 
<code>$ sudo apt install mysql-server</code>
 
<code>$ sudo mysql_secure_installation</code>
 
===== '''Basic MySQL configuration''' =====
''/etc/mysql/mysql.conf.d/mysqld.cnf''
''/etc/mysql/mysql.conf.d/mysqld.cnf''
{| class="wikitable"
|<code>...</code>


<code># LAMS stuff</code>
...
# LAMS stuff
explicit_defaults_for_timestamp
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
transaction-isolation=READ-COMMITTED
sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
max_allowed_packet=32M
# Record slow queries
slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysql-slow.log
long_query_time = 10
[mysqldump]
default-character-set=utf8mb4
hex-blob=1
single-transaction=1
quick=1
...


<code>explicit_defaults_for_timestamp</code>
After installing MySQL, create a user and a DB for LAMS and grant appropriate permissions:


<code>character-set-server = utf8mb4</code>
DROP DATABASE IF EXISTS lams;
CREATE DATABASE lamsdb DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
SET FOREIGN_KEY_CHECKS=1;
GRANT ALL PRIVILEGES ON lamsdb.* TO lamsdbuser@localhost IDENTIFIED BY 'real_secret_pw';
REVOKE SUPER ON *.* from lamsdbuser@localhost;


<code>collation-server = utf8mb4_unicode_ci</code>
==== Wildfly 14.0.1 ====


<code>transaction-isolation=READ-COMMITTED</code>
$ wget https://download.jboss.org/wildfly/14.0.1.Final/wildfly-14.0.1.Final.tar.gz
$ cd /opt/lams
$ tar xvzf wildfly-14.0.1.Final.tar.gz


<code>sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"</code>
==== LAMS source code pre-compilation ====
LAMS is open source and its code is available from [https://github.com/lamsfoundation/lams GitHub]<syntaxhighlight lang="bash">
git clone https://github.com/lamsfoundation/lams.git
</syntaxhighlight>By default branch is LAMS' latest stable release as of July 2021, that's version 4.5. If you need a previous branch, see [https://github.com/lamsfoundation/lams/branches other branches available].


<code>max_allowed_packet=32M</code>
Wherever you have your LAMS v4.5 code, edit the following files


<code># Record slow queries</code>
'''common.properties'''


<code>slow_query_log = 1</code>
Primarily the DB settings and based system.


<code>slow_query_log_file = /var/log/mysql/mysql-slow.log</code>
If you are building LAMS using Windows, set the osPropertiesName to "windows" instead of "unix".  


<code>long_query_time = 10</code>
...
#======== DATABASE PROPERTIES =========
db.host=localhost
db.port=3306
db.name=lamsdb
db.username=lamsdbuser 
db.password=real_secret_pw
...
osPropertiesName=unix
...


<code>#set MySQL timezone to UTC</code>
''If you are building LAMS in a unix based system, then change the file '''unix.properties.''' If you are using Windows, then change the '''windows.properties''' file instead.''


<code>#default-time-zone='+00:00'</code>
'''unix.properties'''


<code>[mysqldump]</code>
Here you will need to figure a path to the content repository
contentrepository.base=/var/opt/lams


<code>default-character-set=utf8mb4</code>
The path to your Wildfly folder
server.home=/usr/local/wildfly-14.0.1/


<code>hex-blob=1</code>
...
contentrepository.base=/var/opt/lams
...
server.home=/opt/lams/wildfly-14.0.1/
...


<code>single-transaction=1</code>
==== Compilation and deployment ====


<code>quick=1</code>
cd lams_build
ant deploy-lams


<code>...</code>
If no errors occurred, you are ready to start Wildfly.  
|}


After installing MySQL, create a user and a DB for LAMS and grant appropriate permissions:
cd /opt/lams/wildfly-14.0.1/bin
./standalone.sh


<code>DROP DATABASE IF EXISTS lams;</code> 


<code>CREATE DATABASE lams4 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;</code>
LAMS should be available at localhost:8080/lams/ 


<code>SET FOREIGN_KEY_CHECKS=1;</code>
By default, LAMS has a set of preconfigured users:
 
{| class="wikitable"
<code>GRANT ALL PRIVILEGES ON lams.* TO lams@localhost IDENTIFIED BY 'real_secret_pw';</code>
|+Default Users
 
!user
<code>REVOKE SUPER ON *.* from lams@localhost;</code>
!password
 
!role
==== Wildfly 14.0.1 ====
|-
<code>wget <nowiki>https://download.jboss.org/wildfly/14.0.1.Final/wildfly-14.0.1.Final.tar.gz</nowiki></code>
|sysadmin
 
|sysadmin
Untar to /opt/lams/
|System administrator
|-
|test1
|test1
|Teacher, student, tutor
|-
|test2
|test2
|Teacher, student, tutor
|-
|test3
|test3
|Teacher, student, tutor
|-
|test4
|test4
|Teacher, student, tutor
|}
Of course, you can create and import users and courses into LAMS at any time from the sysadmin menu. 


as
(OPTIONAL) Wildfly comes with a ton of libraries that LAMS does not use. So to slim Wildfly to only use the libs that LAMS uses, please run the following ant task in the lams_build folder: <syntaxhighlight lang="bash">
ant slim-standalone
</syntaxhighlight>


== LAMS 3.1 ==
== LAMS 3.1 ==

Latest revision as of 00:55, 16 November 2021

Definition

This page contains installation tips for a fresh install of LAMS.

LAMS is a JAVA/JBOSS-based application and needs some installation skills on Windows and good installation skills for Unix.

Note: I put the legacy stuff in the discussion page, e.g. LAMS 2.x for Ubuntu, LAMS 2.1RC for Solaris

LAMS 4.5+

As of July 2021, LAMS 4.5 was released and is the latest stable release.

Getting the LAMS source code

Source code is available from Github. The code branch to use is v4.5

Required software

  • Git
  • Wildfly 14.0.1
  • OpenJDK 11
  • MySQL 8.0
  • Ant (Java task compiler)

OpenJDK 11

In Debian/Ubuntu 20.04

$ sudo apt install openjdk-11-jdk-headless
$ sudo apt install fontconfig

MySQL 8.0 DB

$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb
$ sudo dpkg -i  mysql-apt-config_0.8.15-1_all.deb
$ sudo apt update
$ sudo apt install mysql-server
$ sudo mysql_secure_installation
Basic MySQL configuration

/etc/mysql/mysql.conf.d/mysqld.cnf

...
# LAMS stuff
explicit_defaults_for_timestamp
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
transaction-isolation=READ-COMMITTED
sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
max_allowed_packet=32M
# Record slow queries
slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysql-slow.log
long_query_time = 10

[mysqldump]
default-character-set=utf8mb4
hex-blob=1
single-transaction=1
quick=1
...

After installing MySQL, create a user and a DB for LAMS and grant appropriate permissions:

DROP DATABASE IF EXISTS lams;
CREATE DATABASE lamsdb DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
SET FOREIGN_KEY_CHECKS=1;
GRANT ALL PRIVILEGES ON lamsdb.* TO lamsdbuser@localhost IDENTIFIED BY 'real_secret_pw';
REVOKE SUPER ON *.* from lamsdbuser@localhost;

Wildfly 14.0.1

$ wget https://download.jboss.org/wildfly/14.0.1.Final/wildfly-14.0.1.Final.tar.gz
$ cd /opt/lams
$ tar xvzf wildfly-14.0.1.Final.tar.gz

LAMS source code pre-compilation

LAMS is open source and its code is available from GitHub

git clone https://github.com/lamsfoundation/lams.git

By default branch is LAMS' latest stable release as of July 2021, that's version 4.5. If you need a previous branch, see other branches available.

Wherever you have your LAMS v4.5 code, edit the following files

common.properties

Primarily the DB settings and based system.

If you are building LAMS using Windows, set the osPropertiesName to "windows" instead of "unix".

... 
#======== DATABASE PROPERTIES =========
db.host=localhost
db.port=3306
db.name=lamsdb
db.username=lamsdbuser  
db.password=real_secret_pw
...
osPropertiesName=unix
... 

If you are building LAMS in a unix based system, then change the file unix.properties. If you are using Windows, then change the windows.properties file instead.

unix.properties

Here you will need to figure a path to the content repository contentrepository.base=/var/opt/lams

The path to your Wildfly folder server.home=/usr/local/wildfly-14.0.1/

... 
contentrepository.base=/var/opt/lams 
... 
server.home=/opt/lams/wildfly-14.0.1/
... 

Compilation and deployment

cd lams_build
ant deploy-lams 

If no errors occurred, you are ready to start Wildfly.

cd /opt/lams/wildfly-14.0.1/bin
./standalone.sh


LAMS should be available at localhost:8080/lams/

By default, LAMS has a set of preconfigured users:

Default Users
user password role
sysadmin sysadmin System administrator
test1 test1 Teacher, student, tutor
test2 test2 Teacher, student, tutor
test3 test3 Teacher, student, tutor
test4 test4 Teacher, student, tutor

Of course, you can create and import users and courses into LAMS at any time from the sysadmin menu.

(OPTIONAL) Wildfly comes with a ton of libraries that LAMS does not use. So to slim Wildfly to only use the libs that LAMS uses, please run the following ant task in the lams_build folder:

ant slim-standalone

LAMS 3.1

As of March 2019, we do have a new LAMS installation that works fine in virtual server running Ubuntu 18.x.

However, I do not feel doing system administration anymore (except for this wiki) and I asked our systems person to do it. So there is not documentation, sorry.

Lams Moodle integration. There are two types of integration.

  • LAMS - Moodle integration with a Moodle plugin.
  • LTI integration, i.e. Moodle can "consume" LAMS contents

LTI external tool integration

Documentation

An administrator can manually configure external tools in Site administration > Plugins > Activity modules > External tool> Manage tools so that they are available across the site.

Moodle LAMS integration through a Moodle plugin

  • We did that with LAMS 2.5. To be tested with LAMS 3.0. There is a plugin for download and the method should be the same.

LAMS 3.0

As of November 2018, the current system is LAMS 3.x. You can test this with a demo version. Below, we started documenting an installation on Ubunt 18x, but we did not find time to complete the installation. As you can see something went wrong. Instead, we installed LAMS 3.1 on a virtual server machine.

History

LAMS 2.5 was initially promised for 2014. Then, after a funding cut, the LAMS team was mostly disbanded and the core team found a new "home" in Singapour. Sometimes in 2016 the version number was changed to LAMS 3.0.

Status as of Nov 2018

  • The old LAMS community pages are still online, but no longer maintained.
  • LAMS 3.x is available as commercial offering through Lams International and also through content services (to be verified).


Prerequisites

Java
Usually, this is installed. Check it. In principle, the Open JDK should work, however we do not know if that is true for older version. If it does not (we have to test) this, then it should be replaced with Oracle one. This is very likely the case.
java -version

gives something link:

openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.1)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.1, mixed mode)

Installation did not work with java 11, so I tried OpenJDK version 8. If you don't have Java 8 (it already was on my system), install it first.

udo apt install openjdk-8-jdk
To use Java 8 by default, you can do the following. Most software seems to use Java 8 anyhow ....
sudo update-alternatives --config java


SASS (some kind of CSS pre-processor)
sudo apt install sass
Ant
sudo apt install ant
If exists, stop your old LAMS, e.g.
/etc/init.d/lams2 stop

Kill old LAMS

We did not try to upgrade an old LAMS installation since we did not have many sequences that were worthwhile keeping and since there are no instructions on how to do this. So, export sequences that are worth keeping ...

Remove the startup script for old lams (or similar if it exists)
grep -R lams /etc
For example
rm /etc/rc6.d/K02lams2
rm /etc/rc5.d/S02lams2
rm /etc/rc4.d/S02lams2
rm /etc/rc3.d/S02lams2
rm /etc/rc2.d/S02lams2
rm /etc/rc1.d/K02lams2
rm /etc/rc0.d/K02lams2

Install and configure Wildfly

# cd /src
wget http://download.jboss.org/wildfly/8.2.1.Final/wildfly-8.2.1.Final.tar.gz
tar xvfz wildfly-8.2.1.Final.tar.gz 
sudo mv /src/wildfly-8.2.1.Final /opt/wildfly
sudo chown you:you /opt/wildfly
cd /opt/wildfly
more README.txt   
#Now test
cd /opt/wildfly/bin
./standalone.sh
# If your X server works and if you got Firefox installed on the server machine
firefox --new-instance
http://localhost:9990

Create a new MySQL database and user

(1) Check what you got

mysqlshow -p -u root

(2) Create a new database and user

mysql -u root -p

and copy/paste an adapted version of the following

DROP DATABASE IF EXISTS lams3;  
CREATE DATABASE lams3 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; 
SET FOREIGN_KEY_CHECKS=1; 
GRANT ALL PRIVILEGES ON lams3.* TO lams@localhost IDENTIFIED BY 'real_secret_pw'; 
REVOKE PROCESS,SUPER ON *.* from lams@localhost;

After aborting wildfly you can run intot the following type of error (see also this, dated 07/14/10)

/opt/wildfly/bin$ 18:25:34,136 INFO  [JdbcMigrationLauncher]   If this isn't from a long-running patch, but a stale lock, either:
18:25:34,136 INFO  [JdbcMigrationLauncher]     1) run MigrationTableUnlock (probably 'ant patch.unlock')
18:25:34,136 INFO  [JdbcMigrationLauncher]     2) set the lockPollRetries property so the lock times out
18:25:34,136 INFO  [JdbcMigrationLauncher]        (this is dangerous in combination with long-running patches)
 18:25:34,136 INFO  [JdbcMigrationLauncher]     3) set the 'patch_in_progress' in the patches table to 'F'

In the LAMS DataBASE, run the following SQL

update patches set patch_in_progress = "F";

Dowload, configure and build LAMS

In order to find these files again, we decided to put them in /opt but any place can do.

sudo chown you:your_group /opt/lams 
cd /opt/
git clone https://github.com/lamsfoundation/lams.git

Edit the configuration files

cd /opt/lams/lams_build
  • Make a copy of the *.properties files just be sure. In addition, do not change the properties files themselves since they may be overridden by upgrades. Put them into a file called build.properties.

Change common.properties:

db.host=localhost
db.port=3306
db.name=lams3
db.username=lams.....
db.password=real_secret....

Change file unix.properties:

# Maybe not the best place for you, but at TECFA we always create a /data directory for data that must be kept, e.g. portalware, web server files, etc.
contentrepository.base=/data/lams
#JBoss deploy directory (Unix)
server.home=/opt/wildfly
#Sass executable. 
sass_exec_file=/usr/bin/sass

Copy the properties to file build.properties

Build LAMS

It is not clear to me if one should build various components. In principle, lams-cruise alone should do the trick.

# go to the build directory
cd /opt/lams/lams_build
# Optional: build some stuff
ant build-db
ant deploy-ear    
ant deploy-tools
# build lams (ant will read the build.xml file and "cruise" is a "target" that should build the whole thing)
ant lams-cruise

At the end you should see something like:

lams-cruise:
BUILD SUCCESSFUL
Total time: 3 minutes 35 seconds

Now, in principle, LAMS is deployed in the Wildfly sever and could launch it again.

Compilation errors with OpenJDK 11

Some library is missing with openjdk 11 and something else is wrong. I did not get these errors with Openjdk 8, but then I might have installed some extra libraries in the past. I cannot remember.

   [echo] LAMS Common: Compiling Java sources
   [javac] Compiling 469 source files to /opt/lams/lams_common/build/classes/java
   [javac] warning: [options] bootstrap class path not set in conjunction with -source 8
   [javac] /opt/lams/lams_common/src/java/org/lamsfoundation/lams/policies/dao/hibernate/PolicyDAO.java:22: error: package com.sun.webkit does not exist
   [javac] import com.sun.webkit.PolicyClient;
   [javac]                      ^
   [javac] Note: Some input files use or override a deprecated API.
   [javac] Note: Recompile with -Xlint:deprecation for details.
   [javac] Note: Some input files use unchecked or unsafe operations.
   [javac] Note: Recompile with -Xlint:unchecked for details.
   [javac] 1 error
   [javac] 1 warning

Test running LAMS with WildFly

Make sure that the port that you plan to use with WildFly is free. By default the standalone server version is port 8080.

#Now test
cd /opt/wildfly/bin
./standalone.sh

This will take some time since it will have to digest LAMS.

# If your X server works and if you got Firefox installed on the server machine you can see something on the server.
firefox --new-instance
http://localhost:8080

Shutting down the test server

  • CTRL-C in the console

Else if you ran it as background process:

jboss-cli.sh --connect --command=:shutdown

Documentation and using LAMS

Attention: This wiki page is not a resource for end users like course designers or learners. Instead see:

Official LAMS 2 installation documentation
Lams Moodle integration
Trouble shooting