Moodle LMS on Debian 12

Moodle (Modular Object-Oriented Dynamic Learning Environment) is a free, open-source Learning Management System (LMS) widely used in schools, universities, and enterprises for delivering online education and training. It offers a modular architecture, extensive plugin support, and a user-friendly interface for both educators and learners. Deploying Moodle on Debian 12 ensures a stable, secure, and high-performance environment.


Key Features of Moodle

FeatureDescription
Course ManagementCreate and organize courses, modules, lessons, and activities
User Roles and PermissionsDefine roles such as student, teacher, admin, with fine-grained access control
Quizzes and ExamsBuild advanced quizzes, question banks, and auto-graded assessments
Collaboration ToolsForums, chats, wikis, and messaging for learner engagement
Mobile SupportFully responsive design and official mobile apps
Plugin SystemThousands of plugins for themes, activities, reports, and integrations
Multilingual SupportAvailable in over 100 languages
SCORM and LTI CompliantSupports e-learning standards for content and third-party tool integration
GradebookTrack and manage student grades, performance, and feedback

Why Use Moodle on Debian 12?

  • Stability: Debian is known for its robustness and long-term support, ideal for production Moodle servers.
  • Security: Regular security updates and a large community ensure safe operation of your LMS.
  • Performance: Debian’s lightweight architecture allows for efficient resource use.
  • Package Availability: Debian 12 supports all required services like Apache, PHP 8.x, MariaDB/PostgreSQL, and required PHP modules.
  • Community Support: Both Moodle and Debian have extensive documentation and active communities.

System Requirements on Debian 12

ComponentRecommended Specification
Web ServerApache, Nginx
PHPPHP 8.0 or newer with required extensions
DatabaseMariaDB, MySQL, or PostgreSQL
RAM2 GB minimum (4 GB or more recommended for production)
StorageAt least 200 MB for Moodle core; more for content
OSDebian 12 (Bookworm)

Typical Use Cases

  • Universities and Colleges: Full-featured platform for blended or fully online courses.
  • Schools: Manage digital classrooms, homework, quizzes, and student engagement.
  • Corporate Training: Build custom training programs and monitor employee progress.
  • Freelance Educators: Launch online courses with minimal infrastructure cost.

Comparison with Other LMS Platforms

LMSOpen SourceSelf-HostedCustomizableBest For
MoodleYesYesHighlyEducation, training programs
Canvas LMSYesYesMediumK–12 and higher education
Google ClassroomNoNoLimitedBasic classroom collaboration
ChamiloYesYesMediumSimple course delivery
BlackboardNoYes/CloudLimitedEnterprise academic settings

Deploying Moodle LMS on Debian 12 provides a powerful and flexible foundation for online education. Its compatibility with open-source technologies and ease of customization make it ideal for institutions seeking a scalable and cost-effective e-learning solution. Debian 12 enhances Moodle’s stability, security, and performance, making it a reliable platform for learners and educators alike.


Step 1: Create a Shape.Host Instance

Go to https://shape.host and log in.

Click “Create”.

Choose “Instance”.

Shape.host Resources dashboard with Create > Instance highlighted.

Select your desired server location.

Shape.host instance form with the data center location selector highlighted.

Choose Debian 12 (64-bit) as the operating system.

Pick a plan with at least 2 CPUs, 4 GB RAM, and 20 GB SSD.

Shape.host instance form with the operating system image selector highlighted.

Click Create Instance.

Shape.host instance form with the Create Instance button highlighted.

Find your instance’s IP address under the “Resources” section.

Shape.host Resources dashboard with the server IP address highlighted.

Connect via SSH:

ssh root@your-server-ip

On Windows, use PuTTY.


Step 2: Install Apache, MariaDB, and PHP with Extensions

Update the system and install required packages:

apt update
apt install apache2 mariadb-server php-cli php-intl php-xmlrpc php-soap php-mysql php-zip php-gd php-tidy php-mbstring php-curl php-xml php-pear php-bcmath libapache2-mod-php
Terminal showing APT package management commands and output.
Terminal showing PM2 application process management output.

Step 3: Check Services Status

Ensure Apache and MariaDB are running and enabled:

systemctl is-enabled apache2
systemctl status apache2
systemctl is-enabled mariadb
systemctl status mariadb
Terminal showing systemd service management commands or output.
Terminal showing systemd service management commands or output.

Step 4: Check PHP Version and Modules

Verify PHP installation:

php -v
php -m
Terminal showing php commands or output during Check PHP Version and Modules.

Step 5: Configure UFW Firewall

Install and configure the firewall:

apt install ufw
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
Terminal showing APT package management commands and output.
Terminal showing firewall configuration commands and rules.

Step 6: Secure MariaDB and Create Moodle Database

Edit the MariaDB configuration file (optional tuning):

nano /etc/mysql/mariadb.conf.d/50-server.cnf

Insert the configuration below to enable the ‘Barracuda’ format and set up the default storage engine to ‘InnoDB’.

innodb_file_format = Barracuda 
default_storage_engine = innodb
innodb_large_prefix = 1
innodb_file_per_table = 1
Terminal showing mysql commands or output during Secure MariaDB and Create Moodle Database.

Restart MariaDB to apply any changes:

systemctl restart mariadb
Terminal showing systemd service management commands or output.

Secure the MariaDB installation:

mariadb-secure-installation
Terminal showing MariaDB/MySQL database security configuration prompts.

Create the Moodle database:

mariadb -u root -p

Inside MariaDB:

CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL ON moodle.* TO 'moodle'@'localhost' IDENTIFIED BY "MoodlePassw0rd";
FLUSH PRIVILEGES;
SHOW GRANTS FOR moodle@localhost;
Terminal showing SQL database and user configuration commands.

Step 7: Edit PHP Configuration

Edit php.ini for Apache:

nano /etc/php/8.2/apache2/php.ini

Apply the following changes:

memory_limit = 256M
upload_max_filesize = 60M
max_execution_time = 300
date.timezone = Europe/Amsterdam
max_input_vars = 5000

Restart Apache:

systemctl restart apache2

Step 8: Download and Set Up Moodle

Download and extract Moodle:

cd /var/www
wget https://download.moodle.org/download.php/direct/stable405/moodle-latest-405.tgz
tar -xf moodle-latest-405.tgz
Terminal showing file download commands and transfer output.
Terminal showing the Moodle archive extraction command.

Create data directory and set permissions:

mkdir -p /var/www/moodledata
chown -R www-data:www-data /var/www/moodle /var/www/moodledata
chmod u+rwx /var/www/moodle /var/www/moodledata
Terminal showing file ownership or permission commands.

Step 9: Configure Apache for Moodle

Create Moodle virtual host file:

nano /etc/apache2/sites-available/moodle.conf

Paste the configuration:

<VirtualHost *:80>
DocumentRoot /var/www/moodle/
ServerName your-domain.com
ServerAdmin admin@example.com

<Directory /var/www/moodle/>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>

ErrorLog /var/log/apache2/moodle_error.log
CustomLog /var/log/apache2/moodle_access.log combined
</VirtualHost>
Terminal showing web server configuration text.

Enable Apache modules and site:

a2enmod rewrite
a2ensite moodle.conf
apachectl configtest
systemctl restart apache2
Terminal showing an Apache configuration test.

Step 10: Enable HTTPS with Certbot

Install Certbot and generate SSL:

apt install certbot python3-certbot-apache
certbot --apache --agree-tos --no-eff-email -m contact@shape.host -d debian-tutorials.shape.host
Terminal showing APT package management commands and output.
Terminal showing Certbot certificate commands and messages.

Step 11: Access Moodle in Your Browser

Open your web browser and navigate to:

https://your-domain.com

Follow the Moodle installation wizard to complete the setup.

Select your default language for Moodle and click ‘Next‘.

Moodle setup interface.

Enter your domain name and Moodle data directory to ‘/var/www/moodledata‘.

Moodle setup interface.

Select ‘MariaDB‘ as the default database for Moodle.

Moodle setup interface.

Input your MariaDB database details such as dbname, dbuser, and password.

Moodle installer database connection settings.

Click ‘Continue‘ on the copyright notice.

Moodle setup interface.

Within the ‘Server checks’ section, make sure that your Debian server is met with the Moodle requirements. The status of every item should be ‘OK‘.

Moodle setup interface.

Now you’ll see the Moodle installation like the following:

Moodle setup interface.

Once the installation is finished, enter your admin details (username, email, and password).

Moodle account creation form.

Now enter your Moodle site information.

Moodle site-name, location and authentication settings.

Lastly, you’ll see the following Moodle admin dashboard.

Moodle dashboard.


Deploy your own Moodle LMS on Shape.Host Linux SSD VPS:

Choose Debian 12 and set up your online learning platform in minutes.