Installing Moodle
In this first chapter, we’ll start by installing Moodle.
After providing an overview describing the most suitable setup, we will outline the necessary software and hardware requirements before covering the following installations:
- Installing Moodle in a LAMP environment
- Installing Moodle via the command-line interface (CLI)
- Upgrading Moodle manually and via the CLI and Git
We won’t be covering the installation on operating systems other than Linux, but we will provide some pointers to resources for Windows and macOS.
Moodle can be scaled from a single instructor to an entire institution. We will only cover basic installations and present solutions to some common problems. We will also assume you are familiar with basic Linux system administration.
In this chapter, we will be covering the following topics:
- Preparing your Moodle installation
- Installation in a LAMP environment
- Installation via the command...
Preparing your Moodle installation
Before you start installing Moodle, you have to decide which setup is right for your organization. Once you have decided, there are several hardware and software prerequisites you have to fulfill before you can get started.
Choosing your best setup
There are many different environments in which you can set up Moodle. The three main criteria that will help you determine the correct setup are as follows:
- Flexibility: If you want to have complete control over your system, install plugins, be able to tweak system settings, and make frequent changes to the setup, you should host your own server. However, if your preferred choice is to only administer Moodle while somebody else is looking after the operating system, the web server, and backups, it is better to opt for a professionally-hosted setup, particularly the offerings provided by authorized Moodle Partners.
- Scalability: This is entirely driven by the number of active learners and...
Installation in a LAMP environment
Moodle is developed in Linux using Apache, MySQL, and PHP (known as the LAMP stack). If you have a choice, this is the preferred environment to use. There is an ongoing debate about whether PostgreSQL is the more suitable database option, but we will stick with MySQL/MariaDB as this is the system most administrators are familiar with. Also, some organizations are bound to Microsoft SQL or Oracle. If this is the case, please refer to the respective installation guide, as this is beyond the scope of this book.
The high-level installation process is shown in the following process diagram:
Figure 1.4 – Moodle installation process
We will go through each phase in the remaining subsections, covering each installation step in a Linux environment. The process is the same for other operating systems, which we won’t cover; here are some pointers that should get you started:
- For Windows servers with a small number...
Installation via the command-line interface
Moodle provides a CLI that lets you perform several administrative tasks from the Unix shell prompt. There is no CLI for Windows-based systems. CLI-based installations are useful if you need to automate setups, for example, in an environment where you host multiple Moodle instances.
The CLI is not for the faint-hearted, so be careful when using it. You must execute the installation script as the web server user, usually www-data
or apache
. You can run the installation script, install.php
, in interactive mode (you will have to enter any parameters by hand) or in non-interactive mode, where the script will run silently.
From your dirroot
, you can initiate the interactive script as follows:
sudo –u www-data /usr/bin/php admin/cli/install.php
Something more interesting is the CLI’s non-interactive mode, as this can be used for scripting and automation purposes. A list of all the available parameters can be displayed...
Updating Moodle
We provided an overview of Moodle’s release calendar earlier in this chapter. There is usually no need to install every single minor point release; however, there are several scenarios when you should upgrade your Moodle system:
- Security patches have been issued
- New features have been added
- Bugs have been fixed that affect your setup
- A major version is released
- The support cycle of your setup comes to an end
There are principally two ways Moodle systems can be updated: you can run updates manually (using the web interface or the CLI) or stay up to date using Git commands. Both procedures will be described in this section.
Either way, before you start, ensure you put Moodle in maintenance mode to ensure that no other user is logged in during the update. Go to Site administration | Server | Maintenance mode, choose Enable for Maintenance mode, and enter a maintenance message:
Figure 1.16 – Enabling...
Summary
This chapter taught you how to install and update Moodle.
After providing an overview describing the most suitable setup, we outlined the necessary software and hardware requirements and described Moodle’s versioning strategy and release calendar.
Then, we covered Moodle’s installation via the web and its powerful CLI. We did the same for Moodle upgrades, where we briefly introduced Git.
The fact that Moodle uses a portable software architecture and facilitates standard open source components allows it to be installed on multiple platforms. However, this also means that different peculiarities and quirks must be considered in different environments.
Now that your system is up and running, in the next chapter, we’ll look at the components of Moodle, which will give you a better understanding of the system and how to administer it.