awsmoodle

Bitnami How-To Guides for AWS Cloud

Migrate Data From One Bitnami LMS Powered by Moodle(TM) LMS Instance to Another

Introduction

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:

      * */bitnami/moodle*
      * */bitnami/moodledata*
    
  • Stop all services:

      $ sudo /opt/bitnami/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.

  • Stop Apache:

      $ sudo /opt/bitnami/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:

Copy the new deployment’s configuration file to a safe location before proceeding:

$ sudo cp /bitnami/moodle/config.php ~/

Continue the process as shown below:

  • Delete the Moodle and Moodle data folder of this new instance:

      $ rm -rf /bitnami/moodle
      $ rm -rf /bitnami/moodledata
    
  • Copy the Moodle (/bitnami/moodle) and Moodle data (/bitnami/moodledata) folders from the old installation into the new instance.

  • Copy back the new deployment’s configuration file. After this step, the database password in the /bitnami/moodle/config.php file will be the password for the new instance.

      $ sudo cp ~/config.php /bitnami/moodle/
    
  • Modify file permissions:

      $ cd /bitnami
      $ sudo chown -R daemon:daemon ./moodle ./moodledata
      $ sudo chmod -R g+rwx  ./moodle ./moodledata
    

Step 4: Complete migration and restart services

You should now have the latest version of Moodle with all your data migrated.

Last modification February 9, 2023