nativeInstallermoodle

Upgrade Moodle

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "installdir/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

It is strongly recommended that you create a backup before starting the update process. If you have important data, it is advisable that you create and try to restore a backup to ensure that everything works properly.

Upgrade Moodle following these steps, depending on your installation type:

Approach A: Bitnami installations using system packages

  • Move your current Moodle files:

    $ sudo mv /bitnami/moodle /bitnami/moodle.backup
    
  • Download the new Moodle version. See the example below (the X.Y placeholder in the command refers to the Moodle version number).

    $ wget http://download.moodle.org/download.php/direct/stableX.Y/moodle-latest-X.y.tgz
    
  • Create a new folder and uncompress the files:

    $ sudo mkdir /bitnami/moodle
    $ sudo tar -xzvf moodle-latest-X.Y.tgz -C /bitnami/moodle --strip 1
    
  • Copy your previous configuration file and your modules or themes:

    $ sudo cp -a /bitnami/moodle.backup/config.php /bitnami/moodle/
    $ sudo cp -a /bitnami/moodle.backup/theme/MY_THEME /bitnami/moodle/theme/
    $ sudo cp -a /bitnami/moodle.backup/mod/MY_MOD /bitnami/moodle/mod/
    

    NOTE: Replace the MY_THEME and MY_MOD placeholders with the directory or path names for your downloaded and installed themes and modules (these are different from the ones shipped by Bitnami).

  • Configure file permissions as follows:

    IMPORTANT: To change permissions file, in case you have installed the solution as root, use MYUSER:daemon as system user and group, respectively. Otherwise, simply use MYUSER:MYUSER.

    $ sudo chown daemon:daemon -R installdir/moodle
    $ sudo chmod -R g+rwX installdir/moodle
    $ sudo chown root installdir/moodle/config.php
    $ sudo chmod 640 installdir/moodle/config.php
    
  • Navigate to the application from a browser and follow the steps to upgrade the database to the latest version.

    NOTE: If you want to install modules or plugins from the Moodle administration panel, refer to the migration steps.

Approach B (Self-contained Bitnami installations

  • Move your current Moodle files:

    $ sudo mv installdir/apps/moodle/htdocs/ installdir/apps/moodle/htdocs.backup
    
  • Download the new Moodle version. See the example below (the X.Y placeholder in the command refers to the Moodle version number).

    $ wget http://download.moodle.org/download.php/direct/stableX.Y/moodle-latest-X.Y.tgz
    
  • Create a new folder and uncompress the files:

    $ sudo mkdir installdir/apps/moodle/htdocs/
    $ sudo tar -xzvf moodle-latest-X.Y.tgz -C installdir/apps/moodle/htdocs/ --strip 1
    
  • Copy your previous configuration file and your modules or themes:

    $ sudo cp -a installdir/apps/moodle/htdocs.backup/config.php installdir/apps/moodle/htdocs/
    $ sudo cp -a installdir/apps/moodle/htdocs.backup/theme/MY_THEME installdir/apps/moodle/htdocs/theme/
    $ sudo cp -a installdir/apps/moodle/htdocs.backup/mod/MY_MOD installdir/apps/moodle/htdocs/mod/
    

    NOTE: Replace the MY_THEME and MY_MOD placeholders with the directory or path names for your downloaded and installed themes and modules (these are different from the ones shipped by Bitnami).

  • Configure file permissions as follows:

    IMPORTANT: To change permissions file, in case you have installed the solution as root, use MYUSER:daemon as system user and group, respectively. Otherwise, simply use MYUSER:MYUSER.

    $ sudo chown bitnami:daemon -R installdir/apps/moodle/htdocs/
    $ sudo find installdir/apps/moodle/htdocs/ -type f -exec chmod 664 {} \;
    $ sudo find installdir/apps/moodle/htdocs/ -type d -exec chmod 775 {} \;
    
  • Navigate to the application from a browser and follow the steps to upgrade the database to the latest version.

    NOTE: If you want to install modules or plugins from the Moodle administration panel, refer to the migration steps.

Last modification July 8, 2020