How to Install Moodle 4.4.3 on Ubuntu 24.04 : Step-by-Step Guide

Introduction to Moodle
Moodle is an open-source Learning Management System (LMS) designed to provide educators, administrators, and learners with a single robust, secure, and integrated system for creating personalized learning environments. Trusted by educational institutions and corporations globally, Moodle offers a variety of features such as course management, quizzes, forums, assignments, and more. On this short tutorial we will show you how to install Moodle 4.4.3 on Ubuntu 24.04.
How To Install Moodle On Ubuntu 24.04 LTS
In this guide, we’ll walk you through the process of installing Moodle version 4.4.3 on an Ubuntu 24.04 Linux server, making it a functional, self-hosted LMS platform for your organization or personal use.
Prerequisites
Before you begin, ensure you have the following:
- Ubuntu Linux Server (preferably 20.04 LTS or later)
- Root or sudo access to the server
- A domain name (optional but recommended for production)
- Basic knowledge of using the Linux command line
Step 1: Update Repository Server
Before installing any software, update your Ubuntu server to ensure you have the latest packages and security patches.
$ sudo apt update && sudo apt upgrade -y
Step 2: Install Apache, MySQL, and PHP (LAMP Stack)
Moodle requires a web server, a database, and PHP. We’ll use Apache, MySQL, and PHP, which form the LAMP stack.
2.1 Installing Apache on Ubuntu 24.04
In this short tutorial, we have an article on how to install Apache Web Server on Ubuntu 24.04 LTS operating system. Then in this time, we will verify the Apache Webserver version which was installed on the system by submitting command line :
$ apachectl -v
The output will be shown below :
ramansah@dev02:~$ apachectl -v Server version: Apache/2.4.58 (Ubuntu) Server built: 2024-07-17T18:55:23
2.2 Installing MySQL Server on Ubuntu 24.04
The next step is installing MySQL Server and created a new database dedicated for Moodle. The MySQL Server article has already provided on Installing MySQL 8.0 On Ubuntu 24.04 : Step by step guide tutorial. To verify if MySQL Server has already installed on our system is to query its version, by submitting command line :
$ mysql --version
Output is shown below :
ramansah@dev02:~$ mysql --version mysql Ver 8.0.39-0ubuntu0.24.04.2 for Linux on x86_64 ((Ubuntu))
2.3. Installing Dependencies Packages
On this section we will install PHP and its dependencies packages. For this purpose we will submit the following command lines :
$ sudo apt install libapache2-mod-php php-mysql php-mbstring php-curl php-tokenizer php-xmlrpc php-soap php-zip php-gd php-xml php-intl
Output :
ramansah@dev02:~$ sudo apt install libapache2-mod-php php-mysql php-mbstring php-curl php-tokenizer php-xmlrpc php-soap php-zip php-gd php-xml php-intl [sudo] password for ramansah: Reading package lists... Done Building dependency tree... Done Reading state information... Done php-mysql is already the newest version (2:8.3+93ubuntu2). php-mbstring is already the newest version (2:8.3+93ubuntu2). php-curl is already the newest version (2:8.3+93ubuntu2). php-zip is already the newest version (2:8.3+93ubuntu2). php-gd is already the newest version (2:8.3+93ubuntu2). php-xml is already the newest version (2:8.3+93ubuntu2). . . . NOTICE: You are seeing this message because you have apache2 package installed. Processing triggers for libc-bin (2.39-0ubuntu8.3) ... Processing triggers for libapache2-mod-php8.3 (8.3.6-0ubuntu0.24.04.1) ... Processing triggers for php8.3-cli (8.3.6-0ubuntu0.24.04.1) ...
3. Creating Moodle Database
On this stage we will create a new database within on MySQL Server for Moodle purpose, as we knew, we have installed MySQL database engine on this system. Please following the steps below for creating new database.
1. Login to MySQL Server
2. Crete new database, called as bckinfo_moodledb
3. Create new user, called as ramansahmoodl
4. Grant privileges
1. Login to MySQL Server
ramansah@app02:~$ sudo mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.39-0ubuntu0.24.04.2 (Ubuntu) Copyright (c) 2000, 2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
2. Create New Database
mysql> CREATE DATABASE bckinfo_moodledb DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Query OK, 1 row affected (0.01 sec)
3. Create New User
mysql> CREATE USER 'ramansahmoodl'@'localhost' IDENTIFIED BY 'MdkOI3$djiu'; Query OK, 0 rows affected (0.06 sec)
mysql> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | bckinfo_moodledb | | information_schema | | mysql | | performance_schema | | ramansahdb | | sys | +--------------------+ 6 rows in set (0.03 sec)
4. Granting Privileges
mysql> GRANT ALL PRIVILEGES ON bckinfo_moodledb.* TO 'ramansahmoodl'@'localhost'; Query OK, 0 rows affected (0.01 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec)
4. Installing Moodle 4.3 On Ubuntu 24.04
On this stage, we will install Moodle 4.3 on Ubuntu 24.04 LTS operating system. We will be following several steps as follows :
1. Download and Extract Moodle Software
$ wget https://download.moodle.org/download.php/direct/stable404/moodle-4.4.3.tgz
as shown below :
ramansah@app02:~$ wget https://download.moodle.org/download.php/direct/stable404/moodle-4.4.3.tgz --2024-09-12 12:49:53-- https://download.moodle.org/download.php/direct/stable404/moodle-4.4.3.tgz Resolving download.moodle.org (download.moodle.org)... 104.22.64.81, 172.67.26.233, 104.22.65.81, ... Connecting to download.moodle.org (download.moodle.org)|104.22.64.81|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://packaging.moodle.org/stable404/moodle-4.4.3.tgz [following] --2024-09-12 12:49:54-- https://packaging.moodle.org/stable404/moodle-4.4.3.tgz Resolving packaging.moodle.org (packaging.moodle.org)... 172.67.26.233, 104.22.65.81, 104.22.64.81, ... Connecting to packaging.moodle.org (packaging.moodle.org)|172.67.26.233|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 71209493 (68M) [application/x-gzip] Saving to: ‘moodle-4.4.3.tgz’ moodle-4.4.3.tgz 100%[=====================================>] 67.91M 3.17MB/s in 23s 2024-09-12 12:50:18 (2.99 MB/s) - ‘moodle-4.4.3.tgz’ saved [71209493/71209493]
2. Extract the downloaded file, By using tar command line :
$ tar xzvf moodle-4.4.3.tgz
Then move an extracted files to a specified directory: /var/www/app02.bckinfo/.
ramansah@app02:/var/www$ sudo mkdir /var/www/app02.bckinfo/
[sudo] password for ramansah:
ramansah@app02:~$ sudo mv moodle /var/www/app02.bckinfo/
3. Configuring Virtual Host
On this stage we will create a virtual host configuration for the subdomain, we will use dev01.bckinfo as our subdomain. We will create a new directory for Moodle data than change the user-group and permission on it.
ramansah@app02:~$ sudo mkdir /var/www/app02.bckinfo/moodledata ramansah@app02:~$ cd /var/www/app02.bckinfo ramansah@app02:/var/www/app02.bckinfo$ sudo chown -R www-data:www-data /var/www/app02.bckinfo ramansah@app02:/var/www/app02.bckinfo$ sudo chmod -R 755 /var/www/app02.bckinfo To configure the virtual host, we will create a new file, then add the contents below : ramansah@app02:/var/www/app02.bckinfo$ sudo vi /etc/apache2/sites-available/app02.bckinfo.conf <VirtualHost *:80> ServerName dev02.bcinfo DocumentRoot /var/www/app02.bckinfo/moodle <Directory /var/www/app02.bckinfo/moodle> Options -Indexes +FollowSymLinks +MultiViews AllowOverride All Require all granted </Directory> ErrorLog /var/log/apache2/app02.bckinfo_error.log CustomLog /var/log/apache2/app02.bckinfo_access.log combined </VirtualHost>
Then we need to dnable the rewrite module, virtual host, and restart Apache, by following command lines below :
ramansah@app02:/var/www/app02.bckinfo$ cd ../.. ramansah@app02:/var$ sudo a2enmod rewrite Enabling module rewrite. To activate the new configuration, you need to run: systemctl restart apache2 ramansah@app02:/var$ sudo a2ensite app02.bckinfo Enabling site app02.bckinfo. To activate the new configuration, you need to run: systemctl reload apache2 ramansah@app02:/var$ sudo systemctl restart apache2
Then we need to check the status of the UFW firewall, by submitting command line :
$ sudo ufw status
Output as shown below :
ramansah@app02:/var$ sudo ufw status Status: active To Action From -- ------ ---- 22/tcp ALLOW Anywhere 80/tcp ALLOW Anywhere Apache Full ALLOW Anywhere 22/tcp (v6) ALLOW Anywhere (v6) 80/tcp (v6) ALLOW Anywhere (v6) Apache Full (v6) ALLOW Anywhere (v6)
If UFW is active, allow HTTP and HTTPS ports, by submitting command line below :
ramansah@app02:/var$ sudo ufw allow http Skipping adding existing rule Skipping adding existing rule (v6) ramansah@app02:/var$ sudo ufw allow https Rule added Rule added (v6)
Then we will use a browser to browse the subdomain to test whether Moodle is accessible.
Moodle 4.4.3 Web Installation
Finally we have reached the Moodle web installation. On this stage we will continue the installation in the web browser. We will start the installation by choosing the language, for example English (en), then click the Next, as shown below.
Then we will define the path where the Moodle data will be hosted and chose the database engine as follow:
The we will be prompted to check the server environment meets all the requirements. Click Continue if everything is OK:
Then follow, all the steps until the last.
Great!, Until this stage we have successfully installed Moodle 4.4.3 on Ubuntu 24.04. From this starting point we will explore the platform’s features, customize our courses, and embark on a journey of seamless online learning with Moodle.