Migrate Data From One Bitnami LMS Powered by Moodle(TM) LMS Instance to Another
There are two different ways to upgrade and maintain your Moodle installation:
- Perform a manual upgrade following these instructions.
- Migrate your installation to a new server instance with an updated version of the application and/or underlying components before performing the manual upgrade of Moodle.
This guide describes the second option. We strongly recommend that option because it is the only way to make sure that you have also updated the PHP version. All Bitnami stacks include their own bundled PHP version. As a consequence, even if you install PHP using system packages, the stack will continue using the bundled PHP. The best way to make sure that you are upgrading the whole stack, including new versions of PHP is migrating your current Moodle installation from one instance to a new one.
Follow the instructions below to successfully upgrade all Moodle components. After this, you will be able to upgrade Moodle. That way you will have the whole stack upgraded.
We recommend that you do this from time to time to make sure that you not only have the latest version of Moodle, but also have the latest (and most secure) versions of Apache, MySQL and other software that Moodle runs on. We regularly refresh the images available in the Bitnami library to make sure that you always have access to the most up-to-date software.
Step 1: Backup existing data
Begin by creating a backup of your existing Moodle installation. To do so, perform the following steps:
- Log in to the server console.
- Export the database.
Create a copy of these directories, depending on the installation type:
* *installdir/apps/moodle/htdocs/* * *installdir/apps/moodle/moodledata*
Stop all services:
$ sudo installdir/ctlscript.sh stop
Step 2: Prepare a new Moodle instance
To have a functional copy of the old Moodle installation ready to use in the upgrade process, you need to create a new installation in which you store the backup data.
- Create a new Moodle instance (preferably using the latest available version to ensure that you have the latest security and bug fixes) and note the database password.
- Log in to the server console.
$ sudo installdir/ctlscript.sh stop apache
Step 3: Copy the files from the old instance to the new one
To copy your files from the old instance to the new one, complete the following steps, depending on the approach followed by the new instance:
Delete the Moodle and Moodle data folder of this new instance:
$ rm -rf installdir/apps/moodle/htdocs/ $ rm -rf installdir/apps/moodle/moodledata
Copy the Moodle (installdir/apps/moodle/htdocs/) and Moodle data (installdir/apps/moodle/moodledata) folder from the old installation into the new instance.
After completing the previous step, the database password in the installdir/apps/moodle/htdocs//config.php file will have reverted to the password for the old instance. Update and replace it with the database password for the new Moodle instance.
Modify file permissions:
$ cd installdir/apps/moodle $ sudo chown -R bitnami:daemon ./htdocs/ ./moodledata $ sudo chmod -R g+w ./htdocs/ ./moodledata
Step 4: Complete migration and restart services
- Import the database backup of the old installation.
$ sudo installdir/ctlscript.sh start apache
You should now have the latest version of Moodle with all your data migrated.