HOW TO INSTALL MOODLE 3.6.3 ON Ubuntu 18.04/16.04

Moodle (Modular Object-Oriented Dynamic Learning Environment) is a free open-source learning management system or e-Learning platform, that makes it easy for you to provide online support for your course. Moodle provides a place where you can easily create web pages with information about your course and provide links to word documents, slides, and other resources that your students will want to access. Moodle is built by the Moodle project which is led and coordinated by Moodle HQ, which is financially supported by a network of over 80 Moodle Partner service companies worldwide.

The department and the university provide a wealth of materials and resources, but catering for so many different types of students it can be hard for learners to find those that are most relevant to them. You can use your Moodle to provide links directly to the resources that will be most useful for your students whether e-library resources, skills courses, or information

See Also:


  • An enhanced course overview and new dashboard blocks
  • Next cloud integration
  • Additional privacy settings to further embed our GDPR support
  • Support for Open Badges version 2 specification.
  • Media uploads in assignment feedback

Step 1: Install Required Packages

Install order to setup Moodle first we need to install all required. First, we need to install and configure LAMP and after that all PHP extension.


The PHP development team announces the immediate availability of PHP 7.0. Several bugs have been fixed. PHP 7.0.0 comes with a new version of the Zend Engine, numerous improvements, and new features.

Add PPA Repository:
First, add PPA repositories in your system using the following command:

# sudo add-apt-repository ppa:ondrej/php-7.0

Install PHP7:
After adding PPA repository run mention command to install all PHP required packages:

# apt-get install php7.2 php7.2-curl php7.2-gd php7.2-intl php7.2-ldap php7.2-mysql php7.2-pspell php7.2-xml php7.2-xmlrpc php7.2-zip php7.2-common php7.2-opcache php7.2-mbstring php7.2-soap


MySQL is an open source relational database management system (RDBMS) based on Structured Query Language (SQL).

Install MySQL:
Now install MySQL server and other dependency packages.

# apt-get install mysql-server-5.7

Start MySQL Service:
Now start MySQL service and enable to start on boot using below commands.

For Ubuntu 18.04
# systemctl start mysqld.service
# systemctl enable mysqld.service
For Ubuntu 16.04
# service mysqld start
# chkconfig mysqld on

Set Root Password:
Apply security on MySQL and also set root user password.

# mysql_secure_installation
Mysql Secure Installation

Apache Server:

Apache (HTTPD) is the most popular web server used on Linux systems. Let’s follow following steps of install Apache Server:

Install Apache Server:
After installing MySQL install apache using the following command:

# apt-get install apache2

Start Apache Service:
Now start Apache service and enable to start on boot using below commands.

For Ubuntu 18.04
# systemctl start apache2.service
# systemctl enable apache2.service
For Ubuntu 16.04
# service httpd start
# chkconfig httpd on

Step 2: Create a MySQL Database

Create database user and password which we will use for Moodle database.

# mysql -u root -p
mysql> create database moodle;
mysql> grant all privileges on moodle.* to 'moodle'@'localhost' identified by 'redhat';
Create MySQL Database

Step 3: Download Moodle and Decompress:

After downloading all require packages now we download Moodle and decompress it. You can directly download the latest version of Moodle from the official website.

# cd /var/www/html
# wget
# tar -zxvf moodle-3.6.3.tgz

Set the following permissions for apache user to moodle directory:

# chmod -R 755 /var/www/html/moodle
# chown -R www-data:www-data /var/www/html/moodle

Step 4: Create a Data Directory for Moodle

Moodle obliges a directory to store all its files, session information and so on. The web server needs to be able to write to this directory. This directory must NOT be accessible directly via the web.

# mkdir /var/www/html/moodledata

Set the following permissions for apache user to moodle directory:

# chmod -R 777 /var/www/html/moodledata
# chown -R www-data:www-data /var/www/html/moodledata

Step 5: Configure Web Server VirtualHost

Now we will create a VirtualHost in Apache configuration file /etc/apache2/apache2.conf

<VirtualHost *:80>
DocumentRoot /var/www/html/moodle
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/html/moodle">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted

Restart Apache Server to reload changes.

For Ubuntu 16.04
# service httpd restart
For Ubuntu 18.04
# systemctl restart httpd

Step 6: Finally Start Moodle Web Installer

Open up your web browser and navigate to and follow the instruction:

Choose a language you want to use and click on “Next”

Moodle Install 1

In the next step, we will mention Web Address, Moodle directory, and Data directory path and click on “Next”

Moodle Install 2

Select the database driver and click on “Next”.

Moodle Install 3

Fill the required Database information and click on “Next”.

Moodle Install 4

Now click on Continue to accept the License Agreement.

Moodle Install 5

Now the installer will check for all required modules are installed or not and press continue.

Moodle Install 6
Moodle Install 7

Installing all Moodle modules. Click continue when complete.

Moodle Install 8
Moodle Install 9

Create a Administrator account and click Update.

Moodle Install 10

Now do the front page setting and press save.

Moodle Install 11

Now your Moodle site has been successfully installed. You can log in with the admin account.

Moodle Install 12

Now you see the Moodle dashboard.

Moodle Install 13

Enjoy it!

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.