How to Install Moodle on Ubuntu 20.04

Install Moodle on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure Moodle on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Moodle is a well-known open-source learning management system written in PHP. It offers a wide range of activities and educational tools that enable schools, universities, and related institutions to offer students a flexible learning platform any time, anywhere, without interruption to their course and curriculum.

Install Moodle on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

Step 2. Install LEMP Stack.

WordPress is built with PHP. You can host it like you would any other web app is written in PHP. So, you’re going to need to set Ubuntu up as either a LAMP server. If you haven’t done so already, use our traditional LEMP guide to set up Ubuntu to serve PHP before you continue.

Step 3. Install Moodle on Ubuntu systems.

Download and install the latest version Moodle (version 3.9 at the time of writing). Run the following wget the command to grab the Moodle package:

Finally, adjust file permissions as shown:

Next, create the Moodle data directory:

Step 4. Create a Database for Moodle

Moodle uses MariaDB database to store all its data. Log in to your MariaDB server with the following command and enter your MariaDB root password:

Once you’re in the MariaDB console, create a new database:

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

Next, 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 5. Configuring Nginx.

Now we create a new server block configuration under the NGINX configuration, in the directory /etc/nginx/conf.d/:

For the new configuration to take effect, restart the Nginx service by typing:

Step 6. Configure Firewall.

Open Apache on UFW to allow external access:

Step 7. Accessing Moodle.

In the last step of this guide, we need to access the Moodle Web Interface and finish the installation. To finish the installation, open your browser and navigate to:

That’s all you need to do to installing Moodle on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on Moodle, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.