Toggle navigation

Moodle Image Guide

Version 3.2.1+

Websoft9 Moodle is a pre-configured, ready to run image for running Moodle on Alibaba Cloud.

Moodle is a learning platform designed to provide educators, administrators and learners with a single robust, secure and integrated system to create personalised learning environments.Moodle is built by the Moodle project which is led and coordinated by Moodle HQ, an Australian company of 30 developers which is financially supported by a network of over 60 Moodle Partner service companies worldwide.

Software Version: Moodle3.2.1+
Moodle directory: /data/wwwroot/default/moodle

Basic software environment: LAMP
PHP Configuration File: /usr/local/php/etc/php.ini
Virtual host Configuration File directory: /usr/local/apache/conf/
Virtual host Configuration Command: /root/oneinstack/vhost

Database install directory: /usr/local/mysql
Database data directory: /data/mysql
Database Configuration File: /etc/my.cnf

After the installation of Image,please verify it

  • Login on Alibaba Cloud console,get you Internet IP Address
  • Open you Chrome or Firefox on your local PC,visit the http://Internet IP Address/
  • If verify successfully,you can enter the boot page of Websoft9 below
  • If no response from browser,please check the Security Group settings to ensure that port 80 is been allowed

This Image use MySQL for database

#default user/password:root/123456

MySQL User Guide: Click here

We will show you how to install Moodle :
1.Create the database required for Moodle,
2.Add a virtual host required for Moodle,
3.Start to install Moodle.

Step1. Create a database

1.login in MySQL:

Method 1:Use following URL to open phpMyAdmin page: http://< Public net IP >/phpMyAdmin

Method 2:Use SSH command to login in.

mysql -uroot –p                      #enter mysql console

 #default user/password:root/123456            More MySQL User Guide: Click here


2.create a database:

MySQL [(none)]> create database mydbname;

MySQL [(none)]> show databases;


3.Create a Database User and grants permissions to the User:

MySQL [(none)]> grant all privileges on mydbname.* to username@’localhost’ identified by ‘userpassword’;

MySQL [(none)]> flush privileges;

MySQL [(none)]> exit;


Step2. Add a virtual host

Use SSH Command to Add a virtual host:

[root@iZbp1i4rjdsy216yq7lgucZ ~]# cd /root/oneinstack

[root@iZbp1i4rjdsy216yq7lgucZ oneinstack]# ./

Step3. Install Moodle

1. Open your domain name via browser;

2. Choose a language,Click “Next”;


3.Click “Next”;

4.Click “Next”;

5.Fill in your database user, password, and database name;

6. Click “Continue”;
7. Click “Continue”;
8. Click “Continue”;

9. Set administrator user, password,mail,etc.

10. Set site name,short name,front page summary,etc.
OK, it has been installed successfully.

Websoft9 Moodle Image have installed the phpMyadmin

phpMyAdmin install directory: /data/wwwroot/default/phpMyAdmin


Following is the step for access phpMyadmin

  1. Open Chrome or Firefox on your local PC
  2. visit the http://Internet IP Address/phpMyAdmin,you can enter the login page
  3. select you language,Username:root,Password:123456
  4. Click the button “Go”


Following is the step for access phpMyadmin

  1. User Remote Desktop Connection of Window to connect to you ECS
  2. Install a Chrome or Firefox browser on you ECS
  3. Open Chrome or Firefox on your ECS
  4. visit the http://localhost/phpMyAdmin,you can enter the login page
  5. select you language,Username:root,Password:123456
  6. Click the button “Go”

Below is the very important default site settings for Moodle

  1. Set your default language in Site administration > Language > Language settings. Moodle defaults to common English; if you need US English or another language, add that in Language > Language pack first then you can set it as the default.
  2. Set your default timezone and country in Site administration > Location > Location settings.
  3. Turn off public Guest access (unless you are sure you know how to use it) in Site administration > Plugins > Enrolments > Manage enrol plugins and Hide its button in Site administration > Plugins > Authentication > Manage authentication > Guest login button.
  4. Adjust your minimum password if you need to in Security > Site policies > Password policy.
  5. Verify that cron is running when you set that up during install. Your site will not work properly without it. If the message “The cli/cron.php maintenance script has not been run for at least 24 hours.” shows up in Site administration > Notifications then it is not running properly.

Plugins enable you to add additional features and functionality to Moodle, such as new activities, new quiz question types, new reports, integrations with other systems and many more.Moodle has a list of the most favourite plugins, which might be worth considering for adding to your site.

To install a plugin, its source code must be put (deployed) into the appropriate location inside the Moodle installation directory and the main administration page Administration > Site administration > Notifications must be visited. There are three ways how the plugin code can be deployed into Moodle.

Plugin code may be deployed from within Moodle, either directly from the Moodle plugins directory or by uploading a ZIP file. The web server process has to have write access to the plugin type folder where the new plugin is to be installed in order to use either of these methods.

Note: It is recommended that you proceed with caution and always try installing these plugins in a local experimental server before installing them in a production server.

Plugins Type

All the extend module for Moodle is plugin,below it the type of plugins

  • Activities
  • Blocks
  • Themes
  • Users
  • Course formats
  • Filters
  • Reports
  • Gradebook
  • Admin tools
  • General plugins (Local)
  • Availability conditions
  • Editors
  • Caching
  • Messaging outputs
  • Repositories
  • Portfolios
  • Plagiarism
  • Web service protocols
  • Calendars
  • Search engines
  • Media players
  • Document converters
  • Data formats
  • Antivirus
  • MNet services
  • Other

Installing directly from the Moodle plugins directory

  1. Login as an admin and go to Site administration > Plugins > Install plugins. (If you can’t find this location, then plugin installation is prevented on your site.)
  2. Click the button ‘Install plugins from Moodle plugins directory’.
  3. To install a plugin directly on your Moodle site, you need to log in with your account.
  4. Search for a plugin with an Install button, click the Install button then click Continue.
  5. Confirm the installation request
  6. Check the plugin validation report

Installing via uploaded ZIP file

  1. Go to the Moodle plugins directory, select your current Moodle version, then choose a plugin with a Download button and download the ZIP file.
  2. Login to your Moodle site as an admin and go to Administration > Site administration > Plugins > Install plugins.
  3. Upload the ZIP file. You should only be prompted to add extra details (in the Show more section) if your plugin is not automatically detected.
  4. If your target directory is not writeable, you will see a warning message.
  5. Check the plugin validation report

Installing manually at the server

If you can’t deploy the plugin code via the administration web interface, you have to copy it to the server file system manually (e.g. if the web server process does not have write access to the Moodle installation tree to do this for you).

First, establish the correct place in the Moodle code tree for the plugin type. Common locations are:

  • /path/to/moodle/theme/ – themes
  • /path/to/moodle/mod/ – activity modules and resources
  • /path/to/moodle/blocks/ – sidebar blocks
  • /path/to/moodle/question/type/ – question types
  • /path/to/moodle/course/format/ – course formats
  • /path/to/moodle/admin/report/ – admin reports

See dev:Plugins for the full list of all plugin types and their locations within the Moodle tree.

  1. Go to the Moodle plugins directory; select your current Moodle version, then choose a plugin with a Download button and download the ZIP file.
  2. Upload or copy it to your Moodle server.
  3. Unzip it in the right place for the plugin type (or follow the plugin instructions).
  4. In your Moodle site (as admin) go to Settings > Site administration > Notifications (you should, for most plugin types, get a message saying the plugin is installed).

Note: The plugin may contain language files. They’ll be found by your Moodle automatically. These language strings can be customized using the standard Settings > Site administration > Language editing interface. If you get a “Database error” when you try to edit your language files, there is a strong chance that the language files included within the downloaded ZIP file of this plugin have a coding problem. If you delete the plugin_name/lang/other_language_different_to_English/ folder with the new language strings and the database error disappears, this is indeed the case. Please notify the plugin maintainer, so that it can be fixed in future releases.

You should complete the backup job on a regular basis,includes the two backup methods:

  • Site backup – for saving everything – data stored in the database, uploaded files, Moodle code
  • Course backup – for saving selected activities, resources, blocks, filters, user data etc.

Site Backup

A site backup allows a site administrator to save everything associated with a moodle site. These backups can be restored to bring a site back to the point in time when the backup was made.

A Moodle system backup comprises three parts:

  1. The data stored in the database (For example, a MySQL database)
  2. The uploaded files (For example, site and course files uploaded via Moodle located in moodledata)
  3. The Moodle code (For example, everything in server/htdocs/moodle)

You can confirm where all these things are located in a Moodle installation by checking the config.php file.

  1. $CFG->dbname shows the database name
  2. $CFG->prefix shows the the database table name prefix
  3. $CFG->dataroot controls where the uploaded files are stored; and
  4. $CFG->wwwroot points to where the code is stored.

Backup database,you can use the phpMyAdmin
Backing up the Moodle code and uploaded files, please use the FTP

Automating course backups

Automated course backups runs the same functions as individual course backups. It’s a good idea to schedule backups for when your server isn’t usually busy. Running the backup tool over all the courses can be processor-intensive, so you shouldn’t run it when there are a lot of students trying to access the server. You should always alert users with an announcement on the first page that if they log on during the backup hours they may notice a decrease in performance.

In order to make scheduled backups, you have to set up CRON to run periodically. Please refer to the cron instructions.

To set the backup schedule:

  1. Go to Administration > Site administration > Courses > Backups > Automated backup setup.
  2. Set backup_auto_active to enabled.
  3. Select the days of the week to run the backup.
  4. Set the execution time for the backup process. For most servers, early morning will be the best time. Keep in mind the time zone your server is using.
  5. Set the “Save to…” path. If you can, choose a backup path on another machine or on a different drive than the one Moodle is on. You don’t want to lose your backups at the same time you lose your Moodle site if the drive fails. If you leave the field blank, then backup zip files will be saved in the backup folder of each course files folder. On a Linux server the path might look like: /home/(your user or domain)/public_html/archive/ or if it’s below the publicly accessible folders: /home/(your user or domain)/archive/ if the path is not recognized a red X is shown after saving, otherwise a green check.
  6. Set all other options appropriately.
  7. Click the “Save changes” button.

Tip: To save disk space, you can choose to delete backups older than a specified number of days. If so, you should also specify a minimum number of backups to be kept. (The settings ‘Delete backups older than’ and ‘Minimum number of backups kept’ are new in Moodle 3.0 onwards.)

Once you’ve set up your backup schedule, Moodle will automatically create archives of all the courses on the server at the time you specified. Once the backup is complete, Moodle will send you an email describing the status of the backup.

Backups report

A last execution log of scheduled course backups can be found in Administration > Site administration > Reports > Backups. It displays a list of all course backups made, the time taken to create them, their status (see below), and the next scheduled automated backup execution time.

Clicking the ‘View logs’ icon next to the course name (1 in screenshot below) will display a detailed backup log for a particular course, including date, hour and minute when each step of the backup was performed (2). This log is useful for troubleshooting backup errors.

Start enjoying the cool features of the latest and greatest version of Moodle in four easy steps…

Step 1: Make sure that your server can run Moodle 3.3

(Note: You need to upgrade to Moodle 2.2 before upgrading to 3.3.)

Go to Settings > Site administration > Server > Environment

Status OK for everything? Great! Go to step 2…

Any problems? You probably need to upgrade your server software (such as PHP) to a more recent version.

Step 2: Be prepared!

As usual with any large upgrade, you should always be prepared to “roll back” if there’s an issue with your data or some custom code you’ve added.

A test install
We highly advise you make a copy of your production site to practice the upgrade on first. That way, if you run into any problems that need fixing you won’t affect your main site.
Always make backups
When upgrading your production instance, make sure you have copies of everything, just in case. Full instructions are here: Site backup.

Step 3: Replace your Moodle code

At this point you can replace the Moodle code on your server with the version you downloaded.

Check plugins
Any plugins you have installed will also to be replaced with a version for your new Moodle version. If there is not yet an updated version of the plugin available, it will need to be uninstalled before upgrading your site.

Step 4: Perform the upgrade!

Trigger the upgrade by visiting the admin page.

If you have a large site this may take hours, so we recommend upgrading via command line.

Get details of upgrade,please read

  1. Dashboard->Site administration->Language->Language packs
  2. Then,you can get the message “Language pack .. was successfully installed”
  3. Go to Dashboard->Site administration->Language->Language settings,select you language and click the “Save changes”
  4. Now you can use the new language you have intalled

Users with permission to access Site administration > Courses > Manage courses and categories or Site administration,you can restore courses very easy.

Database corruption usually occurs as a result of a hardware (especially disk-based) failure, or when a disk becomes full. Typical symptoms are failure on login, with this message displayed:

Session Replace: Table ‘./moodle/mdl_sessions2’ is marked as crashed and should be repaired

If you use MySQL,The problem can be repaired using the mysqlcheck command (the command you type is in bold and we assume the database name is ‘moodle’ and its type is MySQL):

#mysqlcheck -u moodleuser -p --auto-repair moodle
Enter password:
moodle.adodb_logsql                      OK
moodle.mdl_assignment                    OK
moodle.mdl_assignment_submissions        OK
error    : Table './moodle/mdl_log' is marked as crashed and should be repaired
error    : Table './moodle/mdl_sessions2' is marked as crashed and should be repaired

Repairing tables
moodle_18_latest.mdl_log                           OK
moodle_18_latest.mdl_sessions2                     OK

Your mysql database server must be running when executing the mysqlcheck command. If there are problems with the tables, the auto-repair option will fix them as shown above. Note that the repair process can take a long time to complete. Re-run the command again to double-check that all is OK.

Individual Moodle tables can be checked by using MySQL Admin/phpMyAdmin

Individual Moodle tables may be repaired using MySQL Admin/PHPMyAdmin as follows:

  1. In the databases section, select the Moodle database.
  2. Click the SQL tab, then in the “Run SQL query/queries on database moodle” field type REPAIR TABLE mdl_tablename
  3. Click the Go button.

For example, to repair the Moodle log tables, type REPAIR TABLE mdl_log In a similar manner to check the Moodle log table, type CHECK TABLE MDL_LOG. This will either say OK or tell you what is wrong. For example it may say “Table marked as crashed”.

If you are getting a blank or partially complete page, or receive a page that presents a short error message that is not informative enough, you can turn on debugging to learn more details.

Turning on debugging will let you see what the error message is, which may help you diagnose the problem. Set this in Site administration > Development > Debugging – see Debugging for more.

When install new extension from back-end it will not successful,may be the permissions of file and folder is not appropriate,you should change it

Web site root permissions to follow:
file 644, folder 755 ,Permissions Users and groups www
If there is a file permissions problem, execute the following three commands:

chown -R www.www /data/wwwroot/default/moodle
find /data/wwwroot/default/moodle -type d -exec chmod 755 {} \;
find /data/wwwroot/default/moodle -type f -exec chmod 644 {} \;

Modify the  /usr/local/php/etc/php.ini file to increase the allowed size for uploads:

; Maximum size of POST data that PHP will accept.
post_max_size = 16M
; Maximum allowed size for uploaded files.
upload_max_filesize = 16M

then,restart the apache

# service httpd restart

The PHP configuration file allows you to configure the modules enabled, the email settings or the size of the upload files. It is located at /usr/local/php/etc/php.ini.

There are some PHP settings that need to be sufficient to install.

e.g The values for PHP.ini below are suggested values only.

  • memory_limit – Minimum: 256M Recommended: 1G or better
  • upload_max_filesize – Minimum: 20M
  • post_max_size – Minimum: 20M
  • max_execution_time: At Least 120 Recommended: 300

After modifying the PHP configuration file, restart both Apache and PHP-FPM for the changes to take effect:

# service httpd restart

If you receive the message “Maximum execution time of 30 seconds exceeded”.You may also like to extend the max_execution_time for PHP and you can modify it by two methods below

Method one: edit your  /usr/local/php/etc/php.ini

; Maximum execution time of each script, in seconds
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 90
; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.

Method two: edit your .htaccess:

<IfModule mod_php5.c>
php_value max_execution_time 90