Most users will want to backup LAMS at some stage. If you are running a server with learners actively using LAMS, then you should be backing up LAMS regularly. Even if you are using LAMS on your personal laptop to develop learning designs before importing them into a shared server, you will want to backup LAMS when you do LAMS upgrade.

If you are using LAMS on Windows and you have MySQL running on the same server as LAMS (which is the normal setup under Windows), then we have written Backup and Restore utilities that runs under Windows so you should use the Windows Backup and Restore instructions.

If you are using LAMS on Linux/Unix/Mac or you are using Windows and MySQL is running on another server, then you will need to do some backups manually, and all restores manually. This is described here. 

When you upgrade LAMS using the Windows upgrader, it will try to do a backup and if it does then you can use the Restore utility to go back to your old version of LAMS should the upgrade failed.

Backing up LAMS

Upgrades

During upgrades, if MySQL is running on the same server as LAMS then the upgrader will offer to do a backup for you. Please select this option if possible as this is the easiest way to do a backup.

Manual Backups

If you are running MySQL on another server you will need to do a "manual" backup before upgrading. You will also want to set up such a backup to run regularly. When we say "manual", we mean a backup that isn't done by LAMS software - it may be one that you set up using your own scripts.  

We recommend a "cold" backup is done, which is a backup done with LAMS shutdown. This is the safest form of backup as it ensures the database is in a consistent state both with itself and with the uploaded files. We recommend that this sort of backup is done before doing an upgrade to LAMS, or any major maintenance. If possible, it should be done on a regular basis, during some scheduled maintenance window.

Items to be backed up:

Unix/Linux/Macintosh

If you have following the standard Unix/Linux/Macintosh installation:

Windows

If you have followed the standard Windows installation:

Restoring LAMS

All restores will have to be done manually.

The instructions below assume that you have used the standard directories suggested by the installer. e.g. in Linux JBOSS is installed in /usr/local/jboss-4.0.2/, the content repository was in /var/opt/lams/repository and the database name is lams2. If your paths or database name is different, then replace these entries with your values

Step 1: Find Backup and Stop LAMS

Step 2: Restore the old files

Linux/Macintosh/Unix

/var/opt/lams$ ls \-R repository 01  repository/01: 1

Windows

Rename the existing directory. Then you have a "backup backup" strategy should the rollback go wrong! Rename c:\lams (or whatever your LAMS directory is called) to c:\lams-failed or some other name that indicates that this is the "broken" directory.

Step 3: Restore the database

To restore the database, we need to delete the tables currently in the lams2 database and then run the sql script <backup directory>\lams20.sql. The easiest way to do this is by dropping the current database and creating a new database.

Using the GUI MySQL Query Browser

If you can run MySQL Query Browser against your MySQL server, then you can follow the instructions on the Restoring Database Using Query Browser page, using the script lams20.sql instead of c:\lams-<date of installation>.bak\dump.sql.

If you are using Window, we recommend using the Query Browser as loading data via the command line client has ruined UTF-8 data in the past, and it doesn't seem to be a problem with the Query Browser.

MySQL Query Browser is a GUI client available from the MySQL website (http://dev.mysql.com/downloads/gui-tools/5.0.html) but you need to run it on your server or have access to the database from another server. If you have MySQL configured to only allow logins from localhost (which many people do for security reasons) then you will not be able to access your databases from another PC running the MySQL Query Browser.

Using the command line

If you are using Linux/Macintosh/Unix and are happy using the command line, the use the command line.

Step 1: Change to the directory containing you backup files. My directory was called /var/tmp/lams20.bak and my database and database user was called lams2. In the instructions below, replace the work "password" with your database password and change the names of the files to match your filenames

Step 2: Drop and then recreate the database.

>$ cd /var/tmp/lams20.bak/  >$ /var/tmp/lams20.bak fiona$ ls jboss-4.0.2      lams.dump  >$ mysql \-ulams2 \-ppassword Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 396 to server version: 5.0.27-standard-log  Type 'help;' or '\h' for help. Type '\c' to clear the buffer.  mysql> drop database lams2; Query OK, 139 rows affected (0.25 sec)  mysql> CREATE DATABASE lams2 DEFAULT CHARACTER SET utf8; Query OK, 1 row affected (0.00 sec)  mysql> exit Bye >$

Step 3: Add the "use" clause to the sql dump file. Add a new line to the very beginning of the dump file (lams.dump) that says "use <databasename>;"

For example:

use lams2;  \-\- MySQL dump 10.10 \-\- \-\- Host: localhost    Database: lams2 \-\- \-----------------------------------------------------\- \-\- Server version       5.0.27-standard-log  /*\!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT \*/; /*\!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS \*/; /*\!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION \*/; /*\!40101 SET NAMES utf8 \*/;

Step 4: Load the dump by redirecting it into the mysql command line client:

>$ mysql \-ulams2 \-ppassword < lams.dump >$

You won't see any output on the screen. If you have access to a GUI client, try looking at the lams_supported_locale table - this contains UTF-8 characters and this will show you whether or not the data has loaded correctly. Unfortunately, you can't check the table using the mysql command line client - I found that it doesn't display all UTF-8 characters correctly. Warning - not all GUI clients show UTF-8 properly either, which is why we recommend the MySQL Query Browser as that does seem to show the data correctly.

The data should look like the data in this screendump:

Click for larger view

If you can't check it in a GUI client then just start LAMS and log in as sysadmin. Go to your profile page and edit your profile. Check the drop down list of locales - if it looks correct then the data should be okay. If it is corrupted, then the UTF-8 characters may have been corrupted during the load, and you need to try to get the MySQL Query Browser running and follow the instructions for that

Step 4: Fix up the registry - Windows Only

If you are on Windows and an upgrade failed, then you will need to fix up the registry. If you are restoring from a backup that you have done as a routine backup and the LAMS version hasn't changed, then you do NOT need to do this step.

This step is not needed to run LAMS, but it may needed to run the LAMS 2.0.x installer again (once you have worked out what the problem was!). If the install had got as far as updating the registry then you will need to change the values, or the installer with think it has already run and refuse to run again.

This requires modifying a crucial part of windows. You must be very careful doing this step or you could stop your PC starting properly.

Last good installation was

language pack

version

server version

December LAMS 2.0 Release

blank

2.0

 

February Language Pack

20070209

 

LAMS 2.0.1 Release

20070308

2.0.1

 

LAMS 2.0.2 Release

20070321

2.0.2

2.0.2.200703211600

LAMS 2.0.3 Release

20070601

2.0.3

2.0.3.200706011007

LAMS 2.0.4 Release installed before April 2008 (No Japanese)

20070524

2.0.4

2.0.4.200706211047

LAMS 2.0.4 Release installed from April 2008 onwards (With Japanese)

20070524

2.0.4

2.0.4.200804031621

LAMS 2.1.0

20080619

2.1

2.1.0.200806190000

LAMS 2.2.0

20081205

2.2

2.2.0.200812050000

LAMS 2.3.0

20090522

2.3

2.3.0.200905220000