In this module, we set up Moodle on Ubuntu by installing the web stack and preparing Moodle’s database and data directory. We start by updating the server and installing Apache + PHP with the required extensions, since Moodle depends on these packages to run properly.

Next, we install MariaDB, secure it, and create a Moodle database and a database user that Moodle will use during the web installer.
 

After the database is ready, we download Moodle 5.1.1, extract it into /var/www/html/moodle, and set the correct permissions.

We then create the moodledata directory in /var/moodledata (this is important because Moodle uses it for uploads, cache, and backups).

Finally, we open the installer in the browser at http://SERVER_IP/moodle and complete the setup using the database details and data directory path.

Learning Outcomes

By the end of Module 2, you should be able to:

  • install the Moodle web stack (Apache, MariaDB, PHP)
  • create the Moodle DB + user
  • set up Moodle files and moodledata
  • complete the Moodle installer and create as admin account

Last modified: Monday, 23 February 2026, 5:04 PM