Revert To Other Backup

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:

  • The JBOSS directory $JBOSS_HOME.
  • The content repository directory (this contains many of the uploaded files)
  • $JBOSS_HOME/server/default/deploy/lams.ear/lams-www.war/secure
  • On Linux/Unix/Macintosh, /etc/lams2
  • Database
    Wildfire chat server
    Backing up Wildfire should also be part of your backup strategy. It contains the logs of chat activities within LAMS. Refer to this page for more details.

Unix/Linux/Macintosh

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

  • Backup these directories:
    • /usr/local/jboss-4.0.2 ($JBOSS_HOME)
    • /var/opt/lams (this contains the content repository plus some error files)
    • /etc/lams2
  • Dump the MySQL Database
    • <mysql directory>/bin/mysqldump --hex-blob -u<database user> -p<database password> <databasename> > /var/tmp/lams2.0.bak/lams20.sql
      e.g. /usr/local/mysql/bin/mysqldump --hex-blob -ulams2 -plamsdemo lams2 > /var/tmp/lams2.0.bak/lams.dump

      Make sure you use the --hex-blob option as otherwise you won't be able to restore this database

Windows

If you have followed the standard Windows installation:

  • Backup the complete LAMS directory, normally c:/lams. This will include JBOSS and the content repository.
  • Dump the MySQL Database:
    • <mysql directory>/bin/mysqldump --hex-blob -u<database user> -p<database password> <databasename> > <backup directory>/lams20.sql
      e.g. "C:\Program Files\MySQL\MySQL Server\bin\mysqldump --hex-blob -ulams2 -plamsdemo lams2 > c:/lams-2.0.3-20070604.bak/lams20.sql

      Make sure you use the --hex-blob option as otherwise you won't be able to restore this database

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

  • Find your backup directory. Hopefully you know where you put it!
  • If LAMS is running, you must stop LAMS. Please do not try to restore LAMS with people using it!

Step 2: Restore the old files

Linux/Macintosh/Unix

  • Rename the existing directories. If you have have existing jboss and content repository directories rename them so that you have a "backup backup" strategy should the rollback go wrong!
    • Rename /usr/local/jboss-4.0.2/ to /usr/local/jboss-4.0.2-failed or some other name that indicates that this is the "broken" directory.
    • Rename /var/opt/lams/repository to /var/opt/lams/repository-failed.
  • Inside the backup directory is the subdirectory jboss-4.0.2. Copy this subdirectory to /usr/local, creating a new directory /usr/local/jboss-4.0.2/.
  • Inside the backup directory is the subdirectory /uploaded-files/repository/. Copy the repository directory to /var/opt/lams/repository. This directory is very large, so there may not be room to copy - you may have to do a rename. The repository directory should look something like (with lots more subdirectories!):

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.

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:

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

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.
  • Go to the Start menu and select Run.
  • In the command box, type "regedit" and click OK

  • Find the entry for HKEY_LOCAL_MACHINE/SOFTWARE/LAMS Foundation/LAMSv2
  • To change an entry on the screen, double click on the name and a dialog box will appear.
  • Change language pack and version entries to the value given in the table below. In the table, find the most recent installation that you did that worked, and use those values. You may need to pick values from more than one line in the table - the language pack releases only change the language pack entry, the LAMS 2.0.1 and LAMS 2.0.2 releases changed the versions and the language pack entries. Make sure you don't put any spaces in the entries.
  • Do File, Exit to exit Regedit.

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
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.