Moodle

Moodle LMS

Moodle (Modular Object-Oriented Dynamic Learning Environment) is an open-source learning management system (LMS) designed to help educators create interactive and flexible online learning environments. Moodle provides a comprehensive set of features such as course management, assessments, assignment handling, quizzes, forum discussions, and integration with various third-party tools.

1. System Requirements

System requirements for Moodle 4.5:

  • PHP 8.1+
  • Database:
    • PostgreSQL 13+
    • MySQL 8.0+
    • MariaDB 10.6.7+
  • Web Server:
    • Apache
    • Nginx
    • OpenLiteSpeed

Before starting the deployment, prepare the following:

  • A VPS or server with Ubuntu 24.04 OS
  • SSH access to the server
  • A domain already pointed to the server

2. Server Preparation

Update the system

sudo apt update
sudo apt upgrade -y

Install Apache

sudo apt install apache2 -y

Install MariaDB

sudo apt install mariadb-server -y

Install the PPA ondrej/php repository.

sudo add-apt-repository ppa:ondrej/php -y
sudo apt upgrade -y

Install PHP 8.3 and the required extensions.

sudo apt install libapache2-mod-php8.3 php8.3 php8.3-cli php8.3-common \
  php8.3-apcu php8.3-mbstring php8.3-gd php8.3-intl \
  php8.3-xml php8.3-soap php8.3-bcmath php8.3-mysql php8.3-zip \
  php8.3-curl php8.3-tidy php8.3-imagick -y

Open the php.ini file.

sudo nano /etc/php/8.3/apache2/php.ini

Change the value of max_input_vars.

max_input_vars = 5000

3. Create a Database

Log in to MariaDB.

sudo mysql

Create a database and user.

CREATE DATABASE lms_moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON lms_moodle.* TO 'lms_moodle'@'localhost' IDENTIFIED BY 'rahasia';
FLUSH PRIVILEGES;
exit

4. Download Moodle

Download Moodle v4.5.1.

wget https://packaging.moodle.org/stable405/moodle-latest-405.tgz

Extract moodle*.tgz.

tar xzvf moodle*.tgz

Create a directory and move the moodle directory to /var/www/:

sudo mkdir -p /var/www/lms.universitas.ac.id/moodledata
sudo mv moodle /var/www/lms.universitas.ac.id

Change the user-group and permissions of the directory:

sudo chown -R www-data:www-data /var/www/lms.universitas.ac.id
sudo chmod -R 755 /var/www/lms.universitas.ac.id

5. Apache Configuration

Create a virtual host configuration:

sudo nano /etc/apache2/sites-available/lms.universitas.ac.id.conf

Enter the configuration.

<VirtualHost *:80>
    ServerName lms.universitas.ac.id
    DocumentRoot /var/www/lms.universitas.ac.id/moodle
    <Directory /var/www/lms.universitas.ac.id/moodle>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog /var/log/apache2/lms.universitas.ac.id_error.log
    CustomLog /var/log/apache2/lms.universitas.ac.id_access.log combined
</VirtualHost>

Enable the rewrite module, virtual host, and restart apache2.

sudo a2enmod rewrite
sudo a2ensite lms.universitas.ac.id
sudo systemctl restart apache2	

6. Install SSL

Install certbot

sudo apt install certbot python3-certbot-apache -y	

Request an SSL certificate.

sudo certbot --non-interactive \
  -m [email protected] \
  --agree-tos \
  --no-eff-email \
  --apache -d lms.universitas.ac.id \
  --redirect	

7. Install Moodle

Access https://lms.universitas.ac.id to install Moodle.

  1. Language: Select English (en), then click Next.
  2. Confirm Paths: Confirm the directory paths, adjust if necessary, then click Next.
  3. Database Driver: Select the appropriate database driver, e.g., MariaDB (native/mariadb), then click Next.
  4. Database Settings: Enter the database name, username, and password, then click Next.
  5. Confirm Copyright: Confirm the copyright, then click Continue.
  6. Server Checks: Perform server checks; if all are OK, click Continue.
  7. Installation: The installation process will begin; once complete, click Continue.
  8. Admin Account: Enter the password and email for the admin account, then click Update profile.
  9. Site Settings: Enter the Full site name, Short name, Site home summary, timezone, and Support email, then click Save changes.
  10. Registration Information: Register the Moodle instance with Moodle developers, or click Skip.

Moodle installation is complete and ready to use.