How to Install Moodle LMS on Ubuntu 14 / 15

November 13, 2015 | By in OPEN SOURCE TOOLS, UBUNTU HOWTO
| 1 Reply More

Moodle is one of the most widely used Open Source Learning Management System by different institutions in the World due to its cost effective and distance learning features for the students. It can be customized for its management features and used to create private on line courses for educators and trainers to achieve learning goals like online content resource repositories, enterprise solutions for managing course registration, course schedules, payment and enrollment, training resources, compliance management and student or employee records.

Moodle is a web based portal that can be used by everyone for the schools, businesses, colleges, charities, universities, and the public sector to manage their account creation, enrollments and permissions etc.

Setup Prerequisites

Moodle is primarily developed in Linux using LAMP Stack that is Apache, MySQL and PHP. So, the basic requirements for Moodle are as follows:

1) System Resources

The recommended system resources to setup Moodle on ubuntu 14/15 requires 5GB of Disk space and 1 GB RAM, a static IP address and FQDN host name.

2) System Update

Login to ubuntu server using the sudo or root credentials and update your system all latest patches and updates by using the below command.

#apt-get update

3) LAMP Setup

We need to setup the LAMP stack on our Ubuntu server in order to install Moodle as its prerequisite. To do so we will installing the Apache web server, MySQL database and PHP by using the below below command.

# apt-get install apache2 mysql-server mysql-client php5

Press "Y" to proceed the installation, you will be asked to configure the mysql root password during the process, choose the strongest one for your security and then press "OK" to proceed the installation.

The installation of Moodle depends upon some extra PHP libraries that are necessary for its successful setup. Let's run the below command to install.

# apt-get install php5-pspell php5-curl php5-gd php5-intl php5-mysql php5-xmlrpc php5-ldap graphviz aspell

After this restart Apache web server and MySQL database services.

# service apache2 restart

Downloading Moodle

To download the latest package of moodle go to the Moodle Download Page and get the latest available package from here.

Moodle Download

You can also get the latest package of Moodle using Git. To do so we will be using the below command in '/opt' directory.

# cd /opt/
# git clone git://

git clone moodle

root@moodle:/opt/moodle# git branch --track MOODLE_29_STABLE origin/MOODLE_29_STABLE
Branch MOODLE_29_STABLE set up to track remote branch MOODLE_29_STABLE from origin.

root@moodle:/opt/moodle# git checkout MOODLE_29_STABLE
Switched to branch 'MOODLE_29_STABLE'
Your branch is up-to-date with 'origin/MOODLE_29_STABLE'.

Now we will have to place the contents into the document root directory of Apache web server and then give it the right permissions by using the below commands.

# 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

MySQL Server Setup

In MySQL server setup first we will configure the default storage engine to innodb by opening the 'my.cnf' file.

# vim /etc/my.cnf
default-storage-engine = innodb

Close the file after saving the changes, then connect to the mysql server with root credentials and create a new database and a user for moodle using the below commands.

mysql> CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Query OK, 1 row affected (0.03 sec)

Query OK, 0 rows affected (0.00 sec)

mysql> quit;

Now restart both the services of MySQL and Apahe web server and move to the next step to start installation of Moodle.

# service mysql restart
# service apache2 restart

Installing Moodle

To complete the installation setup of moodle, open the below link in your web browser to start its web installation by completing the steps.


installing Moodle

Choose the appropriate language that you want to use and click on the NEXT button.

You will be asked to confirm different installation paths for the Web address, Moodle directory and data directory.

Moodle Paths

Make sure that the 'www' diretory has the write permissions other wise you might get the rror unless you fixed the permissions.

Next choose the database drivers according to your installed data base server.

database type

Then in the next section provide the data base settings according the previous configurations and click on the Next button to proceed as shown below.

DB Settings

After this you will be asked to accept the term and conditions to use Moodle and press Continue.

Moodle Terms

Now in the below section you will be able see that all the required plug ins and libraries are successfully setup. Then press on the Continue button to complete the setup.

final server check

The web installation setup will take a while to install all these plugins and libraries. Once all the packages are installed successfully press "Continue" button to move to the next step where you configure your main administrator account which will have complete control over the site. Make sure you give it a secure username and password as well as a valid email address. You can create more admin accounts later on.

Once you have configured your profile and front page setting you will be directed to the administration console of Moodle.

Moodle Dashboard


We have successfully setup Moodle Learning Management system on Ubuntu. Now you can easily use it by adding new users, courses and upload contents with specific permissions according to your requirements from its user friendly web dashboard. Leave us a comment if you find any difficulty during its setup.


Share This :

Free Linux Ebook to Download

Comments (1)

Trackback URL | Comments RSS Feed

  1. Thanks a lot.....

    I tried installing moodle for 2 days and failed ....

    Using this post i did it in 2 hours....complete setup.

    thanks a lot once again.

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.