Moodle is a free, feature-rich open-source learning management system (LMS) that provides an IT platform to support curriculum design and teaching applications for educational informatization. It delivers a learning environment well-suited for primary and secondary education.
Software versions
- Operating system: In the example provided in this topic, CentOS 8.3 is used.
- Apache: A web server with stable performance. In the example provided in this topic, Apache 2.4.37 is used.
- MySQL/MariaDB: A database management system. In the example provided in this topic, MySQL 8.0.26 is used.
- PHP: A server-side scripting language embedded in HTML documents. In the example provided in this topic, PHP 7.3.20 is used.
- Moodle: In the example provided in this topic, Moodle 3.11.6+ is used.
Prerequisites
Step 1: Create a database for Moodle
- Execute the following command to access the MySQL database as the root user. The password of the root user is the one you specified during MySQL configuration.
- Execute the following command to create a database for Moodle.
create database database_name;
- Create a user for the database created for Moodle.
create user username@'localhost' identified by Password;
- Grant all permissions to the user.
grant all privileges on database name.* to 'username'@'localhost';
- Execute the following command to make the preceding commands take effect.
- Execute the following command to exit the MySQL database.
Step 2: Download and configure Moodle
- Execute the following command to decompress the Moodle installation package.
unzip moodle-latest-311.zip
- Execute the following command to move the Moodle files to the website root directory.
mv moodle/ /var/www/html/moodle
- Execute the following command to enter the website root directory of Moodle.
- Execute the following command to specify write permissions for the /var/www/ directory.
chown -R apache: /var/www/
- Execute the following command to restart the Apache service.
Step 3: Install PHP extensions
Each Moodle release specifies minimum requirements for the PHP version and includes several required PHP extensions. A complete environment check is performed before each installation and upgrade.
In the example provided in this topic, Moodle 3.11.6 is used. You also need to execute the following commands in sequence to install the required PHP extensions.
yum install php-pecl-zip
systemctl restart php-fpm
Step 4: Install Moodle
- Enter http://<ECS instance EIP>/moodle/install.php in your local browser to access the Moodle website.
- The following output is displayed.
-
- Select the installation language. After you select "English", click the "Next" button.
- Retain the default value of the path, and click the "Next" button.
- Retain the default value of the database type, and click the "Next" button.
- Configure the database. Enter the database name, username, and password specified in Step 1: Create a database for Moodle, and set the port to 3306. Click the "Save and Continue" button.
- Confirm the copyright statement, and then click the "Continue" button.
- Check the installation components, confirm that the minimum requirements have been met, and then click the "Continue" button.
- Go to the installation system page. When the installation is complete, click the "Continue" button.
- Enter the account information of the main administrator, and then click the "Update Profile" button.
- Specify the website homepage and other information, and then click the "Save Changes" button.
- Go to the website registration page. After the configuration is complete, click the "Register Your Website" button.
- Click the "Continue" button or visit http://<ECS instance EIP>/moodle/ to automatically log in to the homepage of the management backend.
- If the following page is displayed, the Moodle online course system is set up. You can manage the website and specify custom settings based on your business requirements.
Step 5 (Optional): Resolve the domain name
You can configure a domain name for your website, eliminating the need to use a complex, less secure EIP to access it. You can perform the following steps to specify a domain name for the website.
- Apply for an ICP filing for your domain name.
- If your domain name points to a server located in the Chinese mainland, you need to apply for an ICP filing for your domain name. Otherwise, the website is not accessible.
- Configure domain name resolution.
- You need to resolve your domain name to the EIP to access your website.
- After you complete the preceding steps, you can enter http://<domain name> in your local browser to access the Moodle website.
Step 6 (Optional): Enable HTTPS for the website
When a user accesses your website over the HTTP protocol, the browser warns the user that the connection is not secure. We recommend that you enable HTTPS secure communication for your website. This ensures encrypted data transmission between users and your website, effectively defending against network hijacking, information leakage, and other threats.