How to Install Moodle LMS on Debian 12 Server - Manual & Docker

How to Install Moodle LMS on Debian 12 Server - Manual & Docker

How to Install Moodle LMS on Debian 12 Server

This guide covers both manual and Docker-based installations of Moodle LMS on a VPS Linux server.

Requirements

  • Debian 12 VPS (recommended: NETCLOUD24 server VPS)
  • Root or sudo access
  • Minimum 2 GB RAM

Manual Installation

sudo apt update && sudo apt upgrade -y
sudo apt install apache2 mariadb-server php php-mysql libapache2-mod-php php-xml php-curl php-gd php-intl php-zip php-mbstring unzip git -y

# Configure MariaDB
sudo mysql_secure_installation

sudo mysql -u root -p
CREATE DATABASE moodle;
CREATE USER 'moodleuser'@'localhost' IDENTIFIED BY 'secure_pass';
GRANT ALL PRIVILEGES ON moodle.* TO 'moodleuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

# Download Moodle
cd /var/www/html
sudo git clone https://github.com/moodle/moodle.git
cd moodle
sudo git branch --track MOODLE_401_STABLE origin/MOODLE_401_STABLE
sudo git checkout MOODLE_401_STABLE
sudo chown -R www-data:www-data /var/www/html/moodle

# Create Moodledata
sudo mkdir /var/www/moodledata
sudo chown -R www-data:www-data /var/www/moodledata

# Configure Apache
sudo nano /etc/apache2/sites-available/moodle.conf

Add Apache config:

<VirtualHost *:80>
  ServerName yourdomain.com
  DocumentRoot /var/www/html/moodle
  <Directory /var/www/html/moodle>
    Options FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>
sudo a2ensite moodle.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

Finish installation at http://yourdomain.com

Docker Installation

sudo apt install docker.io docker-compose -y
sudo systemctl enable docker --now

# Clone Moodle Docker project
cd /opt
sudo git clone https://github.com/moodlehq/moodle-docker.git
cd moodle-docker

# Copy template config
cp config.docker-template.php config.php

# Start Moodle in Docker
bin/moodle-docker-compose up -d

Visit http://localhost to complete the setup. Default login credentials provided in the config files.

Why Use NETCLOUD24 VPS Linux?

Deploy Moodle LMS reliably and fast with NETCLOUD24 VPS Linux – ideal for schools, universities, and businesses. Enjoy full root access, NVMe drives, and 24/7 support.

© 2025 NETCLOUD24.COM — Fast and secure VPS Linux for your online learning platform.

Comments

Popular posts from this blog

How to Install and Configure GlusterFS on Ubuntu 24.04

How to Install OpenEMR on Ubuntu 24.04 Server - Manual & Docker