Moodle Course Management System on Alibaba Cloud’s Simple Application Server (SAS)

In this tutorial, we'll show you how to set up a Moodle training platform Course Management System on an Alibaba Cloud Simple Application Server (SAS).

What Is Alibaba Cloud’s Simple Application Server (SAS)?

Alibaba Cloud's Simple Application Server (SAS) range is a lightweight cloud server product range that offers rapid and easy-to-use application management. You can speedily spin up servers, OS images, and applications in a region near you and your customers.

SAS provides a rich selection of images, including pre-installed web application images running on Linux and Windows, such as e-commerce solution OpenCart, web application frameworks Joomla and Drupal, and the Ghost publishing platform. Product packages come with compute, storage, monitoring, and networking capabilities.

SAS provides security and maintenance for your instances which can easily integrate with a wide range of Alibaba Cloud products and services.

What Is Moodle?

Moodle is a web-based open source training platform. It is a Course Management System (CMS) application used by many corporate, academic, and learning institutions across the world.

With Moodle you can develop and host online training courses by creating and uploading course materials including interactive tests and gamification. A Moodle application is accessible by a large cohort of students and learners as well as administrators, teachers, and trainers.

The Moodle learning platform is designed to provide educators, administrators, and learners with a single robust, secure, and integrated system for creating personalized learning environments.


You will need an Alibaba Cloud account. If you don't already have one, head over to the Free Trial page to get set up.

Create an Alibaba Cloud Simple Application Server Instance

First, let’s create an Alibaba Cloud Simple Application Server instance. Click through to the Simple Application Server product page from the console.

Click Create Server.

Check your region and select the OS Image tab. We chose Ubuntu 16.04 for our operating system.

Click Buy Now.

Agree to license and terms and click Pay.

When your order is complete, click back to the console.

You will see your new OS image running.

Click through to the image details and click Reset Password.

Add a password for the root user and click OK.

All configuration changes on the instance require a restart.

You can now ssh into the instance and set up Moodle.

The installation instructions in the next section are for the Ubuntu 16.04 OS distribution and thus may change accordingly depending on your choice of operating system.

Login to the SAS server instance with the root user and password, and the public IP.

Setting up Moodle on Ubuntu 16.04

First, let's update the OS image.

apt-get update

Next, we'll install the php7 ppa and a LAMP stack.

add-apt-repository ppa:ondrej/php
apt-get update
apt-get install apache2 mysql-client mysql-server php7.0 libapache2-mod-php7.0

We'll add some additional software that Moodle requires before restarting Apache.

apt-get install graphviz aspell ghostscript clamav php7.0-pspell php7.0-curl php7.0-gd php7.0-intl php7.0-mysql php7.0-xml php7.0-xmlrpc php7.0-ldap php7.0-zip php7.0-soap php7.0-mbstring
service apache2 restart

Next, we'll install Git on the instance, clone the Git Moodle repo, and check out a stable branch.

apt-get install git-core
cd /opt
git clone git://
cd moodle
git branch -a
git branch --track MOODLE_33_STABLE origin/MOODLE_33_STABLE
git checkout MOODLE_33_STABLE

Now we can copy the Moodle repository we just pulled to the web root server folders. We will set some permissions on these folders too.

cp -R /opt/moodle /var/www/html/
mkdir /var/moodledata
chown -R www-data /var/moodledata
chmod -R 777 /var/moodledata
chmod -R 0755 /var/www/html/moodle

Now, let's set up the MySQL service. We have to add a few lines to the configuration file. Open the file for editing.

nano /etc/mysql/mysql.conf.d/mysqld.cnf

Add the following lines to the Basic Settings section:

default_storage_engine = innodb
innodb_file_per_table = 1
innodb_file_format = Barracuda

Restart mysql

service mysql restart

Now we can create the Moodle database and a Moodle user. Change your username and password choices accordingly.

mysql -u root -p

create user 'user'@'localhost' IDENTIFIED BY 'password';

Finally, we can complete the Moodle setup. For the setup, ensure you have full access to the moodle directory.

chmod -R 777 /var/www/html/moodle

After setup, you can lock down the moodle directory once again for security purposes.

chmod -R 0755 /var/www/html/moodle

Go to the following URL:


You should see the Moodle installation page.

Installing Moodle

Follow the steps through the installation process.

You will be asked to confirm paths, to add the database configuration details, and to agree to terms.

Finally, you will see a page detailing the pre-installation server checks.

Once you have checked through and your server environment meets all minimum requirements, you can go ahead and click Continue.

You will see Moodle installing.

When the installation is complete, click Continue. .

You will be asked to add details for the admin user’s profile..

You will be asked to enter some dummy details for your front page which you can change later..

Finally, you can start building your courseware with Moodle.


To summarize, first we set up an Alibaba Cloud Simple Application Server instance and chose Ubuntu 16.04 as the OS Image option.

Onto the Linux Ubuntu image, we installed a LAMP stack (Apache, MySQL, and PHP) before pulling a stable version of Moodle from Git.

Once Moodle was installed, we were able to follow the Moodle installation steps to get the Moodle Course Management System running live on our Alibaba Cloud Simple Application Server instance.

There is so much you can do with Alibaba Cloud’s products and services. Look out for more exciting tutorials at