Deployment Architectures

Moodle 5.0 Stable · Manual + Bitnami Stack Guide

Two deployment pathways for your educational platform. Complete walkthrough of LAMP manual configuration on Ubuntu Server versus deploying local Virtual Appliances, Docker containers, or Amazon Cloud images.

Pipeline I: Deployment Architectural Topology

Client
Reverse Proxy
Nginx / SSL
App
Moodle Stack
Apache + PHP-FPM
Database
MariaDB DB
Persistent Volumes
Storage
Dataroot Volume
Shared NAS/EFS

🔧 ULTIMATE 14‑STEP PIPELINE (every command included)

1. Base OS & full LAMP stack

Explanation
Initial packages setup targeting **PHP 8.2** and basic web / database servers.
bash
sudo apt update && sudo apt upgrade -y
sudo apt install apache2 mariadb-server mariadb-client -y
sudo apt install php8.2 php8.2-cli php8.2-common php8.2-mysql php8.2-xml php8.2-curl php8.2-gd php8.2-intl php8.2-mbstring php8.2-zip php8.2-soap php8.2-bcmath libapache2-mod-php8.2 -y
sudo apt install git nano cron sendmail certbot python3-certbot-apache unzip rsync net-tools -y
sudo a2enmod rewrite ssl headers
sudo systemctl restart apache2

2. Secure MariaDB + Database creation

DB Target Configuration
Provison database `moodle_ulo2026demo` with `utf8mb4` encoding support.
sql
sudo mysql_secure_installation
CREATE DATABASE moodle_ulo2026demo CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'moodleDemo2026'@'localhost' IDENTIFIED BY '2026DemoRegular!!';
GRANT ALL PRIVILEGES ON moodle_ulo2026demo.* TO 'moodleDemo2026'@'localhost';
FLUSH PRIVILEGES;

3. PHP.ini Extreme Tuning

Tuning Details
Configure memory, input limits, and OPcache.
bash
sudo nano /etc/php/8.2/apache2/php.ini
upload_max_filesize = 1080M; post_max_size = 1080M; max_execution_time = 3600
memory_limit = 512M; max_input_vars = 7000; max_input_time = 300
opcache.enable=1; opcache.memory_consumption=256
sudo systemctl restart apache2

4. Clone Moodle 5.0 (MOODLE_500_STABLE)

Folder Name Target
Ensure folder target matches `moodl_ulo2026demo` exactly to prevent 404s.
bash
cd /var/www
sudo git clone -b MOODLE_500_STABLE git://git.moodle.org/moodle.git moodl_ulo2026demo
sudo chown -R www-data:www-data /var/www/moodl_ulo2026demo
sudo chmod -R 755 /var/www/moodl_ulo2026demo

5. 100GB Data Disk (partition & mount)

bash
sudo fdisk /dev/sdb  # n → p → Enter → w
sudo mkfs.ext4 /dev/sdb1
sudo mkdir -p /var/moodledata
sudo mount /dev/sdb1 /var/moodledata
sudo blkid /dev/sdb1 | tee -a /etc/fstab  # add UUID line with defaults,noatime 0 2
sudo chown -R www-data:www-data /var/moodledata && sudo chmod -R 770 /var/moodledata

6. config.php (full enterprise config)

php
cd /var/www/moodl_ulo2026demo && sudo cp config-dist.php config.php
$CFG->dbtype='mariadb'; $CFG->dbhost='localhost'; $CFG->dbname='moodle_ulo2026demo';
$CFG->dbuser='moodleDemo2026'; $CFG->dbpass='2026DemoRegular!!';
$CFG->wwwroot='https://classroom.ulo2026demo.com'; $CFG->dataroot='/var/moodledata';
$CFG->directorypermissions=02775; $CFG->disablelogintoken=true;

7. Apache VHost + SSL (Certbot)

bash
sudo nano /etc/apache2/sites-available/moodle.conf
sudo a2ensite moodle.conf; sudo a2dissite 000-default.conf
sudo certbot --apache -d classroom.ulo2026demo.com
sudo certbot renew --dry-run

8. Cron (every minute + async tasks)

bash
sudo crontab -u www-data -e
* * * * * /usr/bin/php /var/www/moodl_ulo2026demo/admin/cli/cron.php > /dev/null
sudo systemctl enable cron; sudo systemctl start cron
sudo -u www-data php /var/www/moodl_ulo2026demo/admin/cli/cron.php

9. Sendmail & Notification Service

bash
sudo apt install sendmail -y; sudo sendmailconfig

10. Persistent mount (fstab + bind hardening)

bash
sudo mount -a; df -h | grep moodledata

11. Clear adhoc restore/backup deadlock

sql & bash
mysql -u root -p moodle_ulo2026demo -e "DELETE FROM mdl_task_adhoc WHERE classname LIKE '%restore%';"
mysql -u root -p moodle_ulo2026demo -e "DELETE FROM mdl_backup_controllers;"
sudo rm -rf /var/moodledata/temp/backup/* /var/moodledata/cache/*

12. Redis Cache & Session Acceleration

bash
sudo apt install redis-server php8.2-redis -y
sudo systemctl enable redis

13. Advanced Permissions Hardening

bash
sudo chown -R www-data:www-data /var/moodledata /var/www/moodl_ulo2026demo
sudo chmod -R 755 /var/www/moodl_ulo2026demo
sudo chmod -R 770 /var/moodledata

14. Firewall & Security Baseline

bash
sudo ufw allow 22/tcp; sudo ufw allow 80/tcp; sudo ufw allow 443/tcp
sudo ufw enable

Bitnami Deployment Manual

1. Option A: Bitnami Virtual Machine

Virtual Machine Details
Runs Moodle locally on VirtualBox or VMware. Ideal for sandbox testing.
Virtual Machine setup
# Download Bitnami Moodle VM from bitnami.com
# Import to VirtualBox/VMware
# Default credentials: user / bitnami
# Access Moodle at http://SERVER-IP
# SSH: ssh bitnami@SERVER-IP

2. Option B: Docker Container

Docker CLI
Spins up Moodle containers instantly.
Docker run command
docker run -d --name moodle -p 8080:8080 -p 8443:8443 \
  -e MOODLE_USERNAME=admin \
  -e MOODLE_PASSWORD=bitnami123 \
  -e MOODLE_EMAIL=admin@example.com \
  -e MOODLE_SITE_NAME="ulo2026 demo LMS" \
  bitnami/moodle:latest

3. Option C: AWS Cloud Deployment

Cloud Deployment details
Bitnami marketplace instances store Moodle code in /opt/bitnami/moodle.
AWS instructions
# Launch from AWS Marketplace "Bitnami Moodle"
# SSH into instance: ssh -i key.pem bitnami@PUBLIC_IP
# Moodle located at /opt/bitnami/moodle
# Data directory: /bitnami/moodledata

4. Bitnami Directory Structure & key commands

Tuning folders
Bitnami stacks bundle service scripts in /opt/bitnami.
bash · directories
# Installation paths
/opt/bitnami/moodle          # Moodle application code
/bitnami/moodledata          # User uploaded files (persistent storage)
/opt/bitnami/mysql/bin       # Database binaries
/opt/bitnami/apache2/conf    # Apache configuration
/opt/bitnami/php/etc/php.ini # PHP configuration

# Control script
sudo /opt/bitnami/ctlscript.sh start|stop|restart|status

5. Upgrade Bitnami Moodle

Upgrade workflows
Ensure backups are complete before moving folders.
bash · upgrades
# Backup first!
sudo mv /bitnami/moodle /bitnami/moodle.backup

# Download new Moodle version
wget http://download.moodle.org/download.php/direct/stable500/moodle-latest-500.tgz
sudo mkdir /bitnami/moodle
sudo tar -xzvf moodle-latest-500.tgz -C /bitnami/moodle --strip 1

# Restore config and customizations
sudo cp -a /bitnami/moodle.backup/config.php /bitnami/moodle/
sudo cp -a /bitnami/moodle.backup/theme/YOUR_THEME /bitnami/moodle/theme/

# Fix permissions (Bitnami uses 'daemon' user)
sudo chown daemon:daemon -LR /opt/bitnami/moodle
sudo chmod -R g+rwX /opt/bitnami/moodle
sudo chown root /opt/bitnami/moodle/config.php
sudo chmod 640 /opt/bitnami/moodle/config.php

6. UTF8MB4 Encoding & collation support

bash · collation
sudo php /opt/bitnami/moodle/admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci
# Update config.php with:
# $CFG->dboptions = array('dbcollation' => 'utf8mb4_unicode_ci');
sudo /opt/bitnami/ctlscript.sh restart

7. Install Plugins

bash · plugins
# Web Interface: Site admin -> Plugins -> Install plugins
# Manual upload: Upload plugin zip, then:
unzip plugin.zip -d /opt/bitnami/moodle/mod/
# Dev git clone:
cd /opt/bitnami/moodle/mod && git clone https://github.com/USER/plugin.git

8. Debugging Bitnami Moodle

bash · debug configs
# HTTP_HOST undefined error fix inside config.php:
$CFG->wwwroot = 'http://YOUR-SERVER-IP/moodle';

# Enable debugging mode inside config.php:
$CFG->debug = 32767;
$CFG->debugdisplay = 1;

# Watch log sheets:
sudo tail -f /opt/bitnami/apache2/logs/error_log
sudo tail -f /opt/bitnami/php/logs/php_error.log

Config Vault

$CFG->dbname='moodle_ulo2026demo';
$CFG->dbuser='moodleDemo2026';
$CFG->dbpass='2026DemoRegular!!';
$CFG->wwwroot='https://classroom.ulo2026demo.com';
$CFG->dataroot='/var/moodledata';

Bitnami Notice

As of August 2025, Bitnami moved Moodle to legacy/unmaintained status. Use for development/testing or be prepared to maintain your own container.

Bitnami CLI

  • Start Services:
    sudo /opt/bitnami/ctlscript.sh start
  • Stop Services:
    sudo /opt/bitnami/ctlscript.sh stop
  • DB Backup:
    mysqldump -u root -p bitnami_moodle > backup.sql