Moodle development framework
Online learning is on the rise and that informed the decision to write this article on the Moodle development framework. All across the world, there are new ventures to take education to the internet to make it more accessible, affordable, and available to many more people across wide geographical areas. At Alibaba Cloud, we are all about transforming lives and giving back to the community. This step by step guide to the Moodle learning management system will equip you with the knowledge on how to create better experiences in long-distance and online learning programs. Moodle is built on PHP and is freely available in open source license, and therefore, you can use the code for any purpose you please.
Moodle has been used for numerous types of education applications in universities, career training, and online education websites. The main advantage of using Moodle as your e-learning framework is the availability of plugins to help you customize the education environment.
What Is a Learning Management System?
Let us first begin by defining what a learning management system is before we advance on various Moodle concepts. Simply put, learning management systems are platforms that allow the creation of educational programs delivered via the internet. They allow the administration of users, monitoring student progress, generating reports as well as making education materials available. People use education platforms for both dedicated and supplementary career moves in universities, on-job training, and general education advancements. A properly structured learning management system offers a robust solution to managing online education.
Why Are Learning Management Systems Important?
It is possible to build a custom framework to cater to your learning management requirements. However, such an endeavor is not only complex but also expensive when all the infrastructural requirements and code complexity are taken into context. A learning management system (LMS), on the other hand, offers a very rich combination of features out-of-the-box with minimal programming required. Instead, f spending thousands of dollars and days or weeks building a custom solution, an LMS incorporates forums, content management systems, grading systems and many other useful features. LMS systems like Moodle are also very useful when for online student registration, reports, progress monitoring and managing classes. All aspects required to accommodate learning goals are well-catered for in the LMS. Moodle remains one of the most popular frameworks available at the moment.
An Overview of Moodle
You can download Moodle from this link or simply obtain a clone from the git repository. It’s basically a collection of files and folders that consist of plugins, libraries and what is referred to as the Moodle core. While it may be slightly confusing initially, you should get accustomed to it after trying out a few things. It is important to avoid modified versions of the Moodle core since it may be non-responsive in some ways.
To get started, you will need to do the following:
- Install git
- Obtain a Moodle clone
- Establish branches and push to your GitHub repo
We will be running the Moodle system on an Alibaba Cloud Elastic Compute Service instance. The Moodle system requires the following requirements to set up your development environment:
- 160 MB of storage space
- A minimum of 1GB RAM
- An additional 1 GB RAM for every 20 concurrent users
- Sudo privileges and firewall
- LAMP stack running on your machine
Install Moodle on Ubuntu 16.04
In this section, we shall see how to install Moodle on our Alibaba Cloud Ubuntu ECS server. Since Moodle is based on PHP, it requires the accommodation of some libraries to function properly. It is also very sensitive to spelling errors and you will need some library for that as well as for graphing.
If you are running Ubuntu on a custom machine, run an update to make sure everything is up to date using the command below:
$ sudo apt-get update
However, Alibaba Cloud runs on the latest software and you will not need to perform this task on the ECS.
Next, get your dependencies package using the command below:
$ sudo apt-get install aspell graphviz php7.0-curl
php7.0-gd php7.0-intl php7.0-ldap php7.0-mysql php7.0-pspell php7.0-xml php7.0-xmlrpc php7.0-zip
Next, enforce the changes you have mad by restarting the Apache server like so:
$ sudo systemctl restart apache2
As has been noted above, ensure that you have ‘sudo’ privileges to successfully initiate the commands.
Next, install Moodle by running the command below:
$ curl -L https://download.moodle.org/download.php/direct/stable32/moodle-latest-32.tgz > moodle.tgz
The ‘L’ in the command is a redirection instruction to the curl while moodle.tgz has the latest stable Moodle files. Since the files you obtain are compressed, run the command below to extract them to your server:
$ sudo tar -xvzf moodle.tgz -C /var/www/html
Next, run an ‘ls’ command to verify the location of your files like so:
$ ls /var/www/html
You should anticipate an output like the one indicated below:
Now that Moodle is in a web directory, let us inspect the files in the directory like so:
admin composer.json grade
auth composer.lock group mnet
availability config-dist.php Gruntfile.js mod
backup config.php help_ajax.php my
badges CONTRIBUTING.txt help.php notes
behat.yml.dist COPYING.txt index.php npm-
blocks course install
blog dataformat install.php
brokenfile.php draftfile.php INSTALL.txt pix
cache enrol iplookup
calendar error lang
cohort file.php lib
comment files local
competency filter login
completion githash.php media rating
This is a list of the uncompressed directories and this is where all course data will be stored. You will still need to have a directory set up away from the Moodle root.
You now need to a secure directory that is inaccessible through a direct browser search since it is outside the Webroot using the command below:
$ sudo mkdir /var/moodledata
The next step is to make the directory accessible by www-data, the user of the service like so:
$ sudo chown -R www-data /var/moodledata
Next, we shall limit accessing the directory so that only the owner has full rights like so:
$ sudo chmod -R 0770 /var/moodledata
Moodle is all set up on your Ubuntu server but it still does not have a database. The database configuration for Moodle involves three steps:
- Design MySQL database for Moodle data storage
- Implement a data structure anticipated in Moodle design
- Create a Moodle user in the database to allow access
It is important that your SQL-based database is compatible with Moodle. You can make some configuration adjustments in MySQL in the following steps:
Access the configuration files like so:
$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Please note very carefully the lines that we are going to add on MySQL database. We are also using port 3306 in this case:
# * Basic Settings
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
default_storage_engine = innodb
innodb_file_per_table = 1
innodb_file_format = Barracuda
## We have done away with skip-networking and opted to listen only on localhost for compatibility and security reasons.
Save those changes and restart your database server for the new configuration to take effect like so:
$ sudo systemctl restart mysql
Next, we shall create a new SQL database using the command below:
$ mysql -u root -p
Note that you need to provide the root password to the MySQL database in the field. We assume that you are already acquainted with MySQL, otherwise, this may be very difficult for you. By default, MySQL does not have a root password. You should be logged in successfully by now to access the mysql> prompt.
Run the command below:
mysql> CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
We shall proceed to create a Moodle user so that we shall no longer have to remember the MySQL root password. Run the commands below:
mysql> create user 'moodler'@'localhost' IDENTIFIED BY 'moodlerpassword';
The Moodle has been created we now need to give permissions like so:
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO 'moodler'@'localhost' IDENTIFIED BY 'moodlerpassword';
It is all done now, exit the MySQL prompt using the command below:
We have successfully configured MySQL database and all we have to do is initiate Moodle in the browser to complete the last part of our setup.
The last configuration part involves adding some configurations to the site on a browser. It is a necessity that the web server has those configurations in place. That involves changing some permissions in the Moodle root. However, such a permission change grants everyone access to the folder. So, if that is not something that you like, you may want to skip this step. However, you can always revoke those permissions after you are through with the browser configurations.
The following are the steps to approach this issue:
$ sudo chmod -R 777 /var/www/html/moodle
Type http://server_address/moodle in your browser to access an installation setup page:
- Select your language
- Set /var/moodledata as your data directory
- Choose the database driver page and set to sql(native sql)
- Enter the Moodle authentication details you created (username and password)
- Agree to the terms and conditions
- Ensure the ‘Server Check’ page indicates that you have met all minimum requirements
- Moodle will install click continue at the bottom
- You should now have access to the administrator setup page
- Enter a preferred username
- Enter a password
- Enter an email
- Fill all required fields
- Select ‘Update Profiles’
So far so good, we should have access to the ‘Front Page Settings’ where we input the following:
- Website name
- Short name
- Authorise self-registration via email
- Save changes
This will lead you to the dashboard, where you will successfully be logged as an admin. We have completed the setup process and we now have to change the permissions like so:
$ sudo chmod -R 0755 /var/www/html/moodle
However, we still need to make an additional change to improve the security of our website since the module configuration file in the /var/moodledata folder has global writeable permissions.
Let us make some changes like so:
$ sudo nano /var/www/html/moodle/config.php
Then find the following:
$CFG->directorypermissions = 0777;
Make the changes like so:
$CFG->directorypermissions = 0770;
Save the changes and change permissions for the /var/moodledata folder
$ sudo chmod -R 0770 /var/moodledata
Creating Your First Course
Moodle is all setup, what remains is customization to for courses. You need to first register your Moodle website before beginning the customization. That way, you will enroll on the mailing list to receive security alerts and information about new releases.
Access that like so: Site Administration-> Registration.
Fill the provided form so that your Moodle site can be published.
Next, let us change our theme like so:
Site Administration->Appearance->Theme Selector.
Select ‘Change Theme’ to access a host of themes available and select one that you like under the name. Great!
Now, go to ‘Site Home’ and on the course list, select ‘add new Course’. Fill the provide form and then Save and Display.
Our first course is all set for us to add lessons and activities on the course interface. However, you need to assess the level of production readiness for your website before commencing business. For instance, you can include SSL/TSL encryption between the client and the server. You may also set up a regular backup service for your site.
This article has extensively covered the process of setting up a Moodle website. There is plenty of material available about Moodle from the community, that is, if you still need to learn more about the framework. Hopefully, you enjoyed reading this article and found it useful. You may also try installing your first Moodle site on Alibaba Cloud.