Part of the Moodle on AWS Series in collaboration with Nephila Web Technology, Moodle Partner in the Philippines and Amazon Web Services Consulting Partner.
If you have followed up with our Moodle on AWS series, by now you have a blank canvas to draw an Open Source learning experience to your imagination’s content.
But chances are you are following up in the future, when another version of Moodle has come upon us. There’s no way around it: Time to upgrade.
(Actually, that’s not entirely true. If you keep your site properly secure, you can skip every other major Moodle upgrade, or otherwise follow the schedule more leisurely.
In this article, you will learn how to upgrade your AWS hosted Moodle site. Let’s with some preliminary checks and precautions, and jump right in!
Checks and backups before getting started
The information architecture of Moodle consists of three components:
- The Moodle application, contained in the “moodle” folder
- The files used and server by Moodle in activities, plugins and repository, in the “moodledata” folder
- The database
The modular architecture means you can host each part in different places without issue. They could even remain in separate servers. In some cases it could even help the performance on your site. When you upgrade Moodle, you will be modifying the application.
Put Moodle into maintenance
Think of it like a little anaesthetics. Go to
Administration → Server → Maintenance mode
Change the setting to “Enabled.”
If it is likely that a user is going to try and access the site during the upgrade, it can be a good idea to notify any visitor and letting them know when the process is expected to finish. Do so on the text field appearing underneath.
Consider a full site backup
In most cases you can go ahead with the upgrade without affecting your files. But the official recommendation is to create a backup of your whole site. Some good reasons why include:
- New requirements (see next) could cause compatibility issues which might lead to a a corrupt files or database
- Modules and activities could not look the same in a new version of Moodle. You might want to modify them to better fit the new version, but also preserve their originals.
- Ultimately, the Moodle application has full editing permissions over the moodledata files and the database. While unlikely, the upgrade could trigger full reset or restore commands.
Check newer system and application requirements
Check to see if the upgrade require any newer versions of the supporting technologies and languages.
Site Administration → Server → Environment
It is possible that the “Moodle version” dropdown menu shown already includes the requirements for the upcoming version of Moodle you are about to add. If not, just click on the “Update component link” at the left to update the list and find the new version.
Click on the version to which you will upgrade. Moodle will generate a list of checks for each component, information, report and status. Make sure everything has a status “OK”. Otherwise, you will need to perform upgrades for those who show a warning.
Most upgrades can be easily perform by accessing the Linux Server using the terminal (Linux Desktop or Mac) or PuTTY. For a given
_OUTDATED_COMPONENT_, try typing
sudo apt-get update _OUTDATED_COMPONENT_ sudo apt-get service apache2 restart.
Learn how to access the terrminal on our tutorial, part 2.
Make sure you have the compatible versions of the plugins
Many plugins, including most of the most popular ones, are “Early Birds.” This means they make sure a compatible version is available at the time of a major or “first point” Moodle release.
You can make sure the upgrade process updates the plugins too by enabling “Available update notifications.” Do so at
Administration → Server → Update notifications
Make sure the “Automatically check for available updates” box is checked. If you do not understand the meaning of “Required code maturity,” just leave it at “Stable version.”
Upgrade the plugins before upgrading Moodle. If you enabled Update Notification, you can go to
Administration → Notifications
to see if new plugin releases are available, and upgrade them in one click. (Click “Check for available updates” before to make sure you have the latest.)
Moving to the new Moodle
Upgrading your Moodle site is a matter of putting the files of the new release in place of the previous one, while making sure the previous configurations remain in place. In practice, this means:
- Moving the existing Moodle application into a backup location
- Moving the new release files in place
- Grabbing the configuration files from the previous application onto their original place, alongside the new release’s file
Command Line Interface upgrade: The ‘fast’ (and loose?) way
Modern versions of Moodle provide a series of management methods entirely from the terminal or Command Line Interface, or CLI.
Unfortunately, the CLI functionality in Moodle is incomplete and can be prone to errors.
- It does not let you turn Moodle into Maintenance mode. You still must do it from the browser visual interface.
upgradecommand makes several assumptions about the process. In order to customize the upgrade, you need to use Moodle’s Version Control System (VCS), Git. Git is not difficult and it is a generally valuable skill, but it does require some study time.
Learn more at Moodle Docs: Administration via command line.
Backup old Moodle
From the terminal, use
mv to relocate the moodle folder while preserving it:
sudo mv moodle moodle.backup
Move the new Moodle in
Get the new Moodle tarball in place and ‘explode’it. Do it as if you were to do it for the first time. Read more here
Move back plugins
Find the folders containing plugin files in the backup and move them into their original structure which now has the newer Moodle files. The plugin page on the Moodle Directory lets know know where in the directory tree they belong.
If a plugin does not have a version compatible with the new Moodle release, your only choice is to skip it.
Reinstate configuration files
The main location of every change and customization you made to Moodle is on the
configfile. Just grab it from the backup and overwrite the current one, which should be basically blank.
cp moodle.backup/config.php moodle
There could be other files with customized settings depending on the plugin. Look into their documentation, especially if they don’t work properly after upgraded.
Restart Apache, finish and reboot
After restarting Apache, go back to Moodle,
Administration → Server → Maintenance mode
to disable Maintenance mode. (You can also do it from Administration → Notifications .)
Moodle will upgrade and will let you know if all systems are operational, or if there are any outstanding issues.
If after a successful upgrade you believe some parts of the site do not properly reflect the update, try purging the caches. Do so at
Administration → Development → Purge caches
and either purge them all, or selectively.