How to Install Moodle on Ubuntu 18.04

How to Install Moodle on Ubuntu 18.04

Moodle is a web-based open source software for e-learning or creating online learning classes. Moodle is widely applied in schools and colleges including in Indonesia.

The Moodle project is led by Moodle HQ which is financially supported by more than 80 Moodle partner companies.

Moodle features include:

  • Modern, easy to use interface
  • Personalised Dashboard
  • Collaborative tools and activities
  • All-in-one calendar
  • Convenient file management
  • Simple and intuitive text editor

For a complete list of Moodle features, read here.

0.Software used

The software used in this tutorial is:

  • OS: Ubuntu 18.04
  • Web server: Apache 2.4
  • PHP Engine: PHP v7.2
  • Database: MariaDB 10.1
  • Moodle: Moodle v3.8
  • Subomain:
  • SSL: Let’s Encrypt

1.Install Apache

Update Ubuntu first

Install Apache web server

2.Install PHP

Install PHP

3.Install MariaDB

Install MariaDB database

Answer the question

Configure MariaDB

Add the configuration under [mysqld]

MariaDB configuration
MariaDB configuration

Restart MariaDB

Create a database for Moodle

Create database
Create database

4.Download Moodle

Download Moodle v3.8

Create a folder for Moodle

Configure the virtual host for

Enter the virtual host configuration

Activate virtual host and restart Apache

5.Install SSL Let’s Encrypt

Download certbot-auto

SSL request for the subdomain

Install packages, Do you want to continue? [Y/n], answer y

Enter email address

Agree Terms of Service

Consent to be sent information about Let’s Encrypt, you can answer Y or N.

An SSL certificate was created, changed and added a virtual host configuration for SSL.

Then enter 2 to redirect HTTP to HTTPS.

The SSL install for is complete

The SSL certificate is only valid for 90 days, run the renew command to renew the SSL certificate

6.Install Moodle


Choose a language, Next

Choose a language
Choose a language

Fill Data directory with /var/www/moodle/data

Confirm paths
Confirm paths

Database driver, for Type choose MariaDB (native/mariadb)

Choose database driver
Choose database driver

Enter the database name, database user, and database password

Database settings
Database settings

Confirm the license, Continue

Confirm license
Confirm license

Check the server if the server is ready to install Moodle

Server checks
Server checks

Installation is running


Create an administrator account

Administrator account
Administrator account

Enter Full site name, Short name for site and Front page summary

Front page settings
Front page settings

If successful, go directly to the administrator dashboard

Moodle dashboard
Moodle dashboard


  1. Works like a charm, thank you so much. Most moodle tutorials don’t include the domain setup tasks, even the official one for Ubuntu 18.04 doesn’t work that well. Thank you.

  2. Bismillah. Pak musa, saya config vhost nya dengan nama domain yang saya beli sendiri, bisa di akses tp pas sy cek di url nya kok jadi naked IP ya? jadi misal domain sy, tp saya lihat di address bar itu kok bukan melainkan naked IP VPS sy ya pak? ada saran pak? terima kasih.

Leave a Reply

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