How To Install Moodle on Ubuntu 20.04 LTS

Install Moodle on Ubuntu 20.04

In this tutorial, we will show you how to install Moodle on Ubuntu 20.04 LTS. For those of you who didn’t know, Moodle is an Open Source Course Management System (CMS), also known as a Learning Management System (LMS) or a Virtual Learning Environment (VLE). It has become very popular among educators around the world as a tool for creating online dynamic web sites for their students. Moodle brings features to include assignment submission, online quizzes, wiki, grading, instant messages, discussion boards, and others. But since it’s modular software, it can be extended via plugins to add extra functionality.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step by step installation Moodle on a Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian based distribution like Linux Mint.

Install Moodle on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running these following apt commands in the terminal.

Step 2. Install LEMP server.

A Ubuntu 20.04 LEMP server is required. If you do not have LEMP stack installed, you can follow our guide here.

Step 3. Installing Moodle on Ubuntu 20.04.

Use the commands below to download the latest version of Moodle:

We will need to change some folders permissions:

Next, create the Moodle data directory, a place where Moodle can save uploaded files and set its permissions:

Step 4. Configuring MariaDB for Moodle.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

Configure it like this:

Next, we will need to log in to the MariaDB console and create a database for the Moodle. Run the following command:

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for Moodle installation:

Step 5. Configuring Moodle.

Now we create the Moodle main configuration file from the sample configuration file provided with the package:

Look for the database configuration section, then configure the database where all Moodle data will be stored:

Also, configure the Moodle website location as well as the location of the Moodle data directory:

Step 6. Configuring Nginx Web server.

Now we create a new virtual host directive in Nginx, Go to the directory /etc/nginx/conf.d/:

Now, we can restart the Nginx web server so that the changes take place:

Step 6. Accessing Moodle Web Interface.

Moodle will be available on HTTP port 80 by default. Open your favorite browser and navigate to or https://server-ip-address and complete the required steps to finish the installation.

Congratulations! You have successfully installed Moodle. Thanks for using this tutorial for installing Moodle Learning Management System on Ubuntu 20.04 LTS  Focal Fossa. For additional help or useful information, we recommend you to check the official Moodle website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!