Moodle For Every School

Reading time ~6 minutes

Moodle For Every School

Moodle For Every School

1 Abstract

Moodle is a well known and mature LMS (Learning Management System) that is used widely throughout the world. There are several ways for installing and maintaining Moodle and we will see some of them. Then we will present some shell scripts that facilitate the installation and maintenance of Moodle. We will see that they are simpler and more cost effective than the other available solutions.

2 Introduction

The benefits of using Moodle to support the educational process are obvious. The best of all, Moodle is free and open source. However this does not mean that using Moodle does not have any costs at all. These costs are mainly related to the server where Moodle is installed, but also to the IT expert that has to install and maintain it. Moodle is a fairly complex application and it needs an experienced administrator to install and manage it properly. Not all the schools (or even small universities) can afford to have their own server(s) and an experienced systems administrator in their staff.

A solution to this problem is to purchase online Moodle services (Software As A Service). This takes away the need for having your own servers and your own system administrator. But this also has its own costs which sometimes may be even higher than maintaining your own Moodle server.

In this article I will present a set of shell scripts that facilitate the installation and maintenance of Moodle, up to the point that even novice administrators can manage it easily. However making things easy is quite difficult, so these scripts depend on cutting edge technologies in current server administration, like Docker, cloud services, etc. The end result is that every school or university should be able to install and use its own Moodle server quite easily.

3 Installing Moodle

Moodle can be installed in Windows and different Linux distributions (like Debian, Ubuntu, RedHat, FreeBSD). The server can be a physical one, a virtual machine (VirtualBox/VMWare), or a VPS in the cloud. A normal Moodle installation needs a server that has at least 1GB RAM and about 10GB HDD. The steps of installation include:

  • Installing the server itself (the operating system).
  • Installing Apache, PHP and MySQL (or an alternative webserver and DB).
  • Downloading the code of Moodle and putting it in the right place.
  • Creating a directory for the moodle data.
  • Creating an empty database.
  • Starting the installation from the browser and following the step-by-step instructions.
  • Installing any additional modules or themes, configuration of the site, etc.

These documents have more details about installing Moodle:

Overall, it is a long and tedious process even for experienced sysadmins that are familiar with such installations. Then you also need to take care for keeping the operating system up to date, updating/upgrading the Moodle itself, making backups of the data, fixing any problems, etc.

Note: You can also contact/contract any Moodle experts to do the job for you, especially if you need to customize Moodle. Here is a list of Moodle Partners: But this also has its own costs, and it depends on what you need them to do for you.

4 Moodle as a Service

Fortunately there are online services that take care of Moodle installation and hosting for you, so that you can focus on managing your courses. In this case you don't have to pay for a server and you don't have to pay for any IT experts to install and maintain it. You only have to pay for the service (for using Moodle). Usually this results in less expenses and improved quality.

There are lots of online services that offer Moodle as a service:

Usually the installation is done from a web interface (like cPanel, ISPmanager, DirectAdmin, Plesk), with the so called "1-click installation" process. In this process you enter a few settings in a web form, like the admin password, email address etc. and then installation, configuration and everything else is done automatically. This is made possible by software like Softaculous, Fantastico, Installatron, etc.

However these Moodle services may also have some limitations in features, number of users, bandwidth, etc. For example it may allow up to 100 users. When you need to increase these limits the price also gets higher, and sometimes it may become quite expensive.

5 Installing Your Own Moodle in Cloud

Another alternative is to install Moodle in a VPS in cloud, using Docker and shell scripts. Docker is a tool that allows us to create and manage virtual machines. However the virtual machines created by Docker are lightweight and they use much less resources than the traditional virtual machines.

5.1 Get a VPS in cloud

The first step is to get a VPS in cloud. There are lots of companies that offer cheap VPS in cloud, like GoogleCloud, AmazonCloud, Linode, DigitalOcean, AlibabaCloud etc. I have tried GoogleCloud with a VPS of 1.7GB RAM and 10GB HDD, with Ubuntu Server 16.04 (LTS). It costs about 15$/month. For more details about the costs see:

5.2 Install Docker

The steps for installing Docker are detailed here:

apt-get update
apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
curl -fsSL | apt-key add -
add-apt-repository \
   "deb [arch=amd64] \
   $(lsb_release -cs) \
apt-get update
apt-get install docker-ce
systemctl enable docker
docker run hello-world

5.3 Install DockerScripts

DockerScripts is a shell script framework for Docker. It can be installed with the steps listed here:

apt-get install git
git clone /opt/docker-scripts/ds
cd /opt/docker-scripts/ds/
make install

5.4 Install WSProxy

WebServer Proxy is a Docker container that allows name-based virtual hosting for other webserver containers. It also takes care of SSL certificates for the domains that it manages. The steps for installing it are listed here:

ds pull wsproxy
ds init wsproxy @wsproxy
cd /var/ds/wsproxy/
ds make

5.5 Install Moodle

The steps to install and run Moodle in a container are listed here:

ds pull moodle
ds init moodle @moodle1-example-org
cd /var/ds/moodle1-example-org/
ds make

If the domain is a real one, tell wsproxy to get a free SSL certificate for it:

ds wsproxy ssl-cert --test
ds wsproxy ssl-cert

Otherwise add to /etc/hosts the line:

Now you can access the website at:

5.6 Moodle maintenance

There are also some scripts/commands for maintenance, like:

ds backup
ds restore
ds upgrade

6 Summary

Installing Moodle in your VPS, using the DockerScripts framework, is much easier than installing it manually. It makes it possible even for novice administrators to install and maintain a Moodle server.

It is as well much cheaper than outsourcing this job to external Moodle experts, and also cheaper than purchasing Moodle hosting.

Besides these, it is also a flexible and customizable solution that can be adopted to fit the needs of everyone.

As a result, it helps to making Moodle available for every school.

Date: 2017-09-15

Author: Dashamir Hoxha

Created: 2017-09-18 Mon 07:58

Using Docker to Run Everything From a Single Server

Using Docker to Run Everything From a Single ServerUsing Docker to Run Everything From a Single ServerTable of Contents1. Abstract2. The ...… Continue reading

Building SSH Tunnels

Published on March 25, 2017

How to Build a Twitter-Bot

Published on March 24, 2017