Moodle: Learning Management System
Full-featured LMS for courses and training. Quizzes, assignments, and certificates.
Moodle is the world’s most popular open-source Learning Management System (LMS), powering education for over 400 million learners worldwide. This guide shows you how to deploy Moodle in your homelab for personal skill development, corporate training, or educational content delivery.
What is Moodle?
Moodle (Modular Object-Oriented Dynamic Learning Environment) is a comprehensive platform for creating online courses, managing student enrollment, delivering assessments, and tracking learning progress. First released in 2002, Moodle has evolved into a mature, enterprise-grade LMS trusted by universities, corporations, and organizations globally.
Why Self-Host Moodle?
Cost Savings:
- Hosted Moodle plans: $80-300/month for 50-200 users
- Cloud LMS alternatives: $5-15 per user per month
- Self-hosted Moodle: Free, unlimited users
- Annual savings: $1,000-10,000+ depending on scale
Complete Data Ownership:
- All student data stays on your infrastructure
- Full compliance control (GDPR, FERPA, etc.)
- No third-party data access
- Custom retention policies
Unlimited Customization:
- Modify any aspect of the platform
- Install community plugins (1,800+ available)
- Custom themes and branding
- Integration with your existing systems
Scalability and Control:
- No artificial user limits
- No storage restrictions
- Full performance tuning capability
- Deploy across multiple servers if needed
Common Use Cases
Corporate Training:
- Employee onboarding programs
- Compliance training tracking
- Skills development courses
- Certification management
- Performance assessments
Educational Institutions:
- Online course delivery
- Blended learning programs
- Student assessment and grading
- Assignment submission and feedback
- Discussion forums and collaboration
Personal Development:
- Family learning platform
- Homeschool curriculum management
- Hobby and skills training
- Study group coordination
- Personal knowledge organization
Prerequisites
Before deploying Moodle, ensure you have:
System Requirements:
- Docker and Docker Compose installed
- 4GB RAM minimum (8GB+ recommended for 100+ users)
- 2+ CPU cores
- 50GB+ storage (grows with course content)
- Ubuntu 22.04 LTS or similar Linux distribution
Technical Knowledge:
- Basic Linux command-line usage
- Understanding of Docker concepts
- Basic web server knowledge
- Database backup fundamentals
Network Access:
- Static local IP address or DHCP reservation
- Domain name (optional, for SSL/public access)
- Port 80/443 available (or alternative ports)
Understanding Moodle Architecture
Moodle consists of several key components:
Application Server:
- PHP-based web application
- Handles user requests and course logic
- Processes assessments and grading
- Manages user sessions
Database Server:
- PostgreSQL or MariaDB/MySQL
- Stores course structure, user data, grades
- Maintains activity logs
- Manages permissions and roles
Web Server:
- Apache or Nginx
- Serves static content
- Handles SSL termination
- Routes requests to PHP processor
File Storage:
- MoodleData directory
- Course files and uploads
- User submissions
- Temporary cache files
System Architecture:
Internet/Users
|
v
[Reverse Proxy] (optional, for HTTPS)
|
v
[Apache/Nginx] Port 80/443
|
v
[PHP-FPM] Moodle Application
|
v
[MariaDB] Database Server
|
v
[File Storage] /var/moodledata Installation and Deployment
Step 1: Directory Structure Preparation
Create organized directory structure:
# Create project directories
mkdir -p ~/moodle/{moodledata,mariadb}
# Set proper permissions
sudo chown -R 33:33 ~/moodle/moodledata # www-data user
sudo chmod -R 755 ~/moodle/moodledata Directory Explanation:
~/moodle: Project root directory~/moodle/moodledata: Moodle data storage (courses, uploads, cache)~/moodle/mariadb: Database persistent storage
Step 2: Docker Compose Configuration
Create ~/moodle/docker-compose.yml:
version: '3.8'
services:
mariadb:
image: mariadb:10.11
container_name: moodle-db
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: changeme_strong_root_password
MYSQL_DATABASE: moodle
MYSQL_USER: moodleuser
MYSQL_PASSWORD: changeme_strong_moodle_password
volumes:
- ./mariadb:/var/lib/mysql
networks:
- moodle-network
command: --max_allowed_packet=64M --innodb_buffer_pool_size=512M
moodle:
image: bitnami/moodle:latest
container_name: moodle
restart: unless-stopped
depends_on:
- mariadb
environment:
# Database Configuration
MOODLE_DATABASE_TYPE: mariadb
MOODLE_DATABASE_HOST: mariadb
MOODLE_DATABASE_PORT_NUMBER: 3306
MOODLE_DATABASE_NAME: moodle
MOODLE_DATABASE_USER: moodleuser
MOODLE_DATABASE_PASSWORD: changeme_strong_moodle_password
# Admin Account
MOODLE_USERNAME: admin
MOODLE_PASSWORD: changeme_admin_password
MOODLE_EMAIL: [email protected]
# Site Configuration
MOODLE_SITE_NAME: "My Learning Platform"
MOODLE_HOST: YOUR-SERVER-IP
MOODLE_SKIP_BOOTSTRAP: "no"
# PHP Configuration
PHP_MEMORY_LIMIT: 512M
PHP_UPLOAD_MAX_FILESIZE: 256M
PHP_POST_MAX_SIZE: 256M
PHP_MAX_EXECUTION_TIME: 300
# Performance
BITNAMI_DEBUG: false
ports:
- "8080:8080"
- "8443:8443"
volumes:
- ./moodledata:/bitnami/moodledata
networks:
- moodle-network
networks:
moodle-network:
driver: bridge
volumes:
mariadb:
moodledata: Important Configuration Notes:
- Replace
changeme_*passwords with strong, unique passwords - Update
YOUR-SERVER-IPwith your actual server IP - Change
[email protected]to your email - Adjust
PHP_MEMORY_LIMITbased on expected usage
Step 3: Generate Secure Passwords
Generate strong passwords for production:
# Generate database root password
openssl rand -base64 32
# Generate Moodle database user password
openssl rand -base64 32
# Generate admin password
openssl rand -base64 24 Save these passwords securely in a password manager.
Step 4: Deploy Moodle
# Navigate to project directory
cd ~/moodle
# Pull Docker images
docker-compose pull
# Start services
docker-compose up -d
# Monitor startup progress
docker-compose logs -f Initial setup takes 3-5 minutes while Moodle initializes the database.
Step 5: Verify Deployment
# Check container status
docker-compose ps
# Both containers should show "Up"
# Check logs for successful startup
docker-compose logs moodle | grep "ready"
# Verify database connection
docker-compose logs moodle | grep "database" Step 6: Access Moodle
Open browser and navigate to:
- HTTP:
http://YOUR-SERVER-IP:8080 - HTTPS:
https://YOUR-SERVER-IP:8443
Initial Login:
- Username:
admin - Password: (the password you set in docker-compose.yml)
Course Creation and Management
Creating Your First Course
Navigate to Course Management:
- Log in as admin
- Click Site administration (gear icon)
- Navigate to Courses → Add a new course
Course Configuration:
General Settings:
├─ Course full name: "Introduction to Docker"
├─ Course short name: "DOCKER101"
├─ Course category: Create "Technology" category
├─ Course start date: Select appropriate date
├─ Course end date: Optional, leave blank for ongoing
└─ Course ID number: Optional unique identifier
Description:
├─ Course summary: Detailed course description
├─ Course image: Upload banner image (recommended 800x450px)
└─ Tags: docker, containers, devops
Format:
├─ Format: Topics (or Weekly for time-based courses)
├─ Number of sections: 10 (can add more later)
└─ Hidden sections: Made invisible
Appearance:
├─ Force language: Default (or specific language)
├─ Number of announcements: 5
└─ Show activity reports: Yes Click Save and display.
Course Structure Options
Topic Format (Recommended):
Course: Introduction to Docker
├─ Section 0: General announcements
├─ Section 1: Container Fundamentals
│ ├─ Video: What are Containers?
│ ├─ Reading: Container vs VM Comparison
│ └─ Quiz: Fundamentals Check
├─ Section 2: Docker Installation
│ ├─ Assignment: Install Docker
│ ├─ Forum: Installation Help
│ └─ File: Installation Guide PDF
└─ Section 3: Running Containers
├─ Video: First Container
└─ Assignment: Deploy Nginx Weekly Format:
Course: 8-Week Python Bootcamp
├─ Week 1 (Jan 15-21): Python Basics
├─ Week 2 (Jan 22-28): Data Structures
├─ Week 3 (Jan 29-Feb 4): Functions
└─ Week 4 (Feb 5-11): Object-Oriented Programming Adding Course Content
Add Activity or Resource:
- Enable editing (top right toggle)
- In desired section, click + Add an activity or resource
- Select activity type
Common Activity Types:
Assignment:
- Students submit files or text
- Manual or automated grading
- Due dates and late submission policies
- Rubric-based grading support
Quiz:
- Multiple choice, true/false, short answer
- Question bank for reuse
- Automatic grading
- Timed assessments
- Random question selection
Forum:
- Discussion boards
- Q&A format
- Subscription and email notifications
- Rating and moderation options
File:
- PDF documents, slides, images
- Direct download or display in browser
- Version control
- Activity completion tracking
URL:
- External links
- Embedded content
- Open in new window or popup
Page:
- HTML content pages
- Formatted text with images
- Embedded videos
- Multi-page lessons
Enrollment Management
Enrollment Methods:
Manual Enrollment:
- Course → Participants
- Click Enroll users
- Search for user
- Assign role (Student, Teacher, etc.)
- Click Enroll
Self-Enrollment:
- Course → Settings → Users → Enrollment methods
- Add method → Self enrollment
- Configure:
- Enrollment key: Optional password
- Default role: Student
- Enrollment duration: Unlimited or specific period
- Users can enroll themselves via course catalog
Cohorts (Bulk Enrollment):
# Create cohort for department
Site administration → Users → Cohorts → Add new cohort
Cohort Settings:
├─ Name: Engineering Team
├─ ID: ENG2025
└─ Description: All engineering department members
# Enroll entire cohort in course
Course → Users → Enrollment methods → Cohort sync
└─ Select cohort → All members auto-enrolled Assessment and Grading
Creating Quizzes
Quiz Setup:
- Add activity → Quiz
- Configure quiz settings:
General:
├─ Name: Module 1 Assessment
├─ Description: Test your knowledge of containers
└─ Open/Close dates: Define availability window
Timing:
├─ Time limit: 30 minutes
├─ When time expires: Submit automatically
└─ Submission grace period: 1 minute
Grade:
├─ Attempts allowed: 2
├─ Grading method: Highest grade
├─ Pass grade: 70%
└─ Grade to pass: 7.0 (out of 10.0)
Review options:
├─ Immediately after attempt: Show correct answers
├─ Later: Show scores only
└─ After quiz closes: Full review Adding Questions:
- Click Edit quiz
- Click Add → a new question
- Question types available:
Multiple Choice:
Question: What is a Docker container?
Answers:
○ A virtual machine (0%)
● An isolated process with bundled dependencies (100%)
○ A type of physical server (0%)
○ A programming language (0%) True/False:
Question: Containers share the host operating system kernel.
● True (100%)
○ False (0%) Short Answer:
Question: What command creates a new Docker container?
Accepted answers: docker run, docker container run Essay (Manual grading):
Question: Explain the benefits of containerization over traditional VMs.
Expected response length: 200-500 words
Grading rubric: Attach detailed criteria Gradebook Configuration
Access Gradebook: Course → Grades
Grade Categories:
Course Total (100%)
├─ Quizzes (40%)
│ ├─ Quiz 1: Fundamentals (10%)
│ ├─ Quiz 2: Advanced (15%)
│ └─ Final Exam (15%)
├─ Assignments (40%)
│ ├─ Lab 1: Installation (10%)
│ ├─ Lab 2: Networking (15%)
│ └─ Project: Deploy Stack (15%)
└─ Participation (20%)
├─ Forum Posts (10%)
└─ Attendance (10%) Grading Scale:
A: 90-100%
B: 80-89%
C: 70-79%
D: 60-69%
F: Below 60% Assignment Grading
Grading Interface:
- Assignment → View all submissions
- Click student name
- Grading panel shows:
- Submitted file(s)
- Submission text
- Grading rubric
- Feedback comments
- Grade input field
Rubric-Based Grading:
Criteria: Code Quality (25 points)
├─ Excellent (25): Clean, well-documented, follows best practices
├─ Good (20): Mostly clean, adequate documentation
├─ Adequate (15): Works but needs improvement
└─ Poor (10): Significant issues
Criteria: Functionality (50 points)
├─ Excellent (50): All requirements met, no bugs
├─ Good (40): Most requirements met, minor issues
├─ Adequate (30): Basic functionality, some bugs
└─ Poor (20): Does not work correctly User Management
Creating User Accounts
Manual User Creation:
- Site administration → Users → Accounts → Add a new user
User Account Details:
├─ Username: jsmith
├─ Password: Generate or manual entry
├─ First name: John
├─ Last name: Smith
├─ Email: [email protected]
├─ City/Town: New York
├─ Country: United States
└─ Timezone: America/New_York
Profile Picture: Upload photo (optional)
Force password change: Yes (recommended for first login) Bulk User Upload:
- Create CSV file with user data:
username,firstname,lastname,email,password,city,country
jsmith,John,Smith,[email protected],TempPass123,NYC,US
mjones,Mary,Jones,[email protected],TempPass123,NYC,US
bwilson,Bob,Wilson,[email protected],TempPass123,NYC,US - Site administration → Users → Upload users
- Upload CSV file
- Map columns to Moodle fields
- Preview and confirm import
Role Management
Default Roles:
Administrator:
- Full system access
- Site configuration
- User management
- Plugin installation
- Use sparingly (1-2 accounts)
Course Creator:
- Create new courses
- Manage own courses
- Cannot access site administration
- Good for department heads
Teacher:
- Full access within assigned courses
- Create activities, grade students
- Manage enrollments
- View all reports
Non-editing Teacher:
- View course content
- Grade students
- View reports
- Cannot modify course structure
Student:
- Access enrolled courses
- Submit assignments
- Take quizzes
- Participate in forums
Custom Roles:
- Site administration → Users → Permissions → Define roles
- Click Add a new role
- Base on existing role
- Modify specific permissions
- Example: “Teaching Assistant” role with limited grading
Mobile App Configuration
Moodle provides official mobile apps for iOS and Android.
Enable Mobile Access
Server Configuration:
- Site administration → Mobile app → Mobile settings
- Enable web services for mobile: Yes
- Mobile service: Moodle Mobile
- Save changes
Mobile App Features:
- Site administration → Mobile app → Mobile features
- Enable:
- Download course content: Yes
- Offline access: Yes
- Push notifications: Yes
Student Mobile Setup
iOS/Android Installation:
- Download “Moodle” app from App Store or Google Play
- Open app
- Click Add site or Connect to your site
- Enter site URL:
https://yourdomain.com(or IP address) - Login with username and password
Features Available:
- View course content
- Download materials for offline access
- Submit assignments (photos, documents)
- Take quizzes
- Participate in forums
- Receive push notifications
- View grades
- Calendar integration
Push Notifications Setup
Enable Notifications:
- Site administration → Mobile app → Mobile settings
- Scroll to Push notifications
- Enter app ID (from Moodle documentation)
- Save configuration
User Notification Preferences: Users configure in: Profile → Preferences → Message preferences
Notification Types:
├─ Assignment due: Push + Email
├─ Assignment graded: Push + Email
├─ Forum post: Push only
├─ Quiz available: Email only
└─ Course updates: Push + Email Backup Procedures
Automated Course Backups
Configure Automatic Backups:
- Site administration → Courses → Backups → Automated backup setup
Backup Settings:
├─ Active: Yes
├─ Schedule: Daily at 3:00 AM
├─ Backup storage: Course backup file area
├─ Keep: 5 most recent backups
└─ Include users: Yes
Backup Includes:
├─ Activities and resources: Yes
├─ User data: Yes
├─ Grade history: Yes
├─ Comments: Yes
├─ Logs: No (reduces size)
└─ Course files: Yes Save configuration.
Manual Course Backup:
- Course → More → Course reuse → Backup
- Select backup options (same as above)
- Click Next, review settings
- Click Perform backup
- Download backup file (.mbz format)
Database and System Backups
Complete Backup Script:
Create ~/moodle/backup.sh:
#!/bin/bash
# Configuration
BACKUP_DIR="/backups/moodle"
DATE=$(date +%Y%m%d_%H%M%S)
RETENTION_DAYS=14
# Create backup directory
mkdir -p $BACKUP_DIR
echo "Starting Moodle backup: $(date)"
# Stop Moodle (optional, for consistency)
cd ~/moodle
# docker-compose stop moodle
# Backup database
echo "Backing up database..."
docker exec moodle-db mysqldump -u root -pchangeme_strong_root_password --single-transaction --routines --triggers moodle | gzip > $BACKUP_DIR/moodle-db-$DATE.sql.gz
if [ $? -eq 0 ]; then
echo "Database backup completed"
else
echo "Database backup FAILED"
exit 1
fi
# Backup moodledata directory
echo "Backing up moodledata..."
tar -czf $BACKUP_DIR/moodledata-$DATE.tar.gz ~/moodle/moodledata --exclude='cache' --exclude='sessions' --exclude='temp'
echo "Moodledata backup completed"
# Backup docker-compose configuration
cp ~/moodle/docker-compose.yml $BACKUP_DIR/docker-compose-$DATE.yml
# Restart Moodle
# docker-compose start moodle
# Remove old backups
find $BACKUP_DIR -name "moodle-db-*.sql.gz" -mtime +$RETENTION_DAYS -delete
find $BACKUP_DIR -name "moodledata-*.tar.gz" -mtime +$RETENTION_DAYS -delete
find $BACKUP_DIR -name "docker-compose-*.yml" -mtime +$RETENTION_DAYS -delete
echo "Backup completed: $(date)"
echo "Location: $BACKUP_DIR" Make Executable and Schedule:
chmod +x ~/moodle/backup.sh
# Test backup
~/moodle/backup.sh
# Schedule daily backups at 2 AM
crontab -e
# Add: 0 2 * * * /home/user/moodle/backup.sh >> /var/log/moodle-backup.log 2>&1 Restore Procedures
Restore Course from Backup:
- Site administration → Courses → Restore course
- Upload .mbz backup file
- Select destination (new course or overwrite existing)
- Choose restore options
- Click Perform restore
Complete System Restore:
# Stop containers
cd ~/moodle
docker-compose down
# Restore database
gunzip < /backups/moodle/moodle-db-YYYYMMDD_HHMMSS.sql.gz | docker exec -i moodle-db mysql -u root -pchangeme_strong_root_password moodle
# Restore moodledata
rm -rf ~/moodle/moodledata/*
tar -xzf /backups/moodle/moodledata-YYYYMMDD_HHMMSS.tar.gz -C ~/moodle/moodledata --strip-components=3
# Fix permissions
sudo chown -R 33:33 ~/moodle/moodledata
sudo chmod -R 755 ~/moodle/moodledata
# Start containers
docker-compose up -d
# Verify restoration
docker-compose logs -f Troubleshooting
Common Issues and Solutions
Issue: Cannot Access Moodle Web Interface
Diagnostics:
# Check containers running
docker-compose ps
# Check logs
docker-compose logs moodle
docker-compose logs mariadb
# Verify port binding
sudo netstat -tlnp | grep 8080 Solutions:
- Ensure containers started:
docker-compose up -d - Check firewall:
sudo ufw allow 8080/tcp - Verify
MOODLE_HOSTsetting in docker-compose.yml - Try accessing via localhost:
http://localhost:8080
Issue: File Upload Fails
Solutions:
- Increase PHP limits in docker-compose.yml:
environment:
PHP_UPLOAD_MAX_FILESIZE: 512M
PHP_POST_MAX_SIZE: 512M
PHP_MAX_EXECUTION_TIME: 600 - Restart container:
docker-compose restart moodle - Check available disk space:
df -h ~/moodle/moodledata Issue: Slow Performance
Solutions:
- Increase PHP memory:
environment:
PHP_MEMORY_LIMIT: 1G - Optimize MariaDB:
command: >
--max_allowed_packet=64M
--innodb_buffer_pool_size=1G
--query_cache_size=32M
--query_cache_type=1 Enable Moodle caching:
- Site administration → Plugins → Caching → Configuration
- Add Redis or Memcached store (advanced)
Upgrade resources:
- Increase RAM allocation
- Use SSD for moodledata directory
- Add more CPU cores
Issue: Database Connection Failed
Solutions:
# Check database container
docker-compose logs mariadb
# Verify database credentials match in both services
# Check MYSQL_PASSWORD matches MOODLE_DATABASE_PASSWORD
# Test database connection
docker exec -it moodle-db mysql -u moodleuser -p
# Enter password and verify access
# Restart both containers
docker-compose restart Issue: Email Notifications Not Sending
Solutions:
- Configure SMTP settings:
- Site administration → Server → Email → Outgoing mail configuration
SMTP Settings:
├─ SMTP hosts: smtp.gmail.com:587
├─ SMTP security: TLS
├─ SMTP username: [email protected]
├─ SMTP password: app-specific-password
└─ No-reply address: [email protected] - Test email:
- Site administration → Server → Email → Test outgoing mail configuration
- Enter test email address
- Send test message
Issue: Quiz Not Saving Student Answers
Solutions:
- Check browser console for JavaScript errors
- Disable browser extensions
- Clear Moodle cache: Site administration → Development → Purge all caches
- Verify adequate session storage space
- Check PHP session configuration
Advanced Configuration
Performance Optimization
Enable Caching: Site administration → Plugins → Caching → Configuration mode
Caching Stores:
├─ Application: File cache (default)
├─ Session: File cache
└─ Request: Static acceleration
Optimization:
├─ Enable string cache: Yes
├─ Enable JavaScript compression: Yes
├─ Enable CSS compression: Yes
└─ Cache templates: Yes Plugin Installation
Popular Plugins:
BigBlueButton (Video Conferencing):
- Site administration → Plugins → Install plugins
- Search “BigBlueButton”
- Install and configure with BBB server
Certificate (Course Completion Certificates):
- Install Certificate module
- Add to course as activity
- Design custom certificate
- Auto-issue on course completion
Attendance (Session Tracking):
- Install Attendance activity
- Add to course
- Mark attendance each session
- Export reports
Theme Customization
Change Theme:
- Site administration → Appearance → Themes → Theme selector
- Choose theme (Boost is default, modern design)
- Customize colors and logo
Custom CSS: Site administration → Appearance → Additional HTML
/* Add to "Within HEAD" section */
<style>
:root {
--primary-color: #2196F3;
--secondary-color: #FF9800;
}
.navbar {
background-color: var(--primary-color);
}
.btn-primary {
background-color: var(--secondary-color);
}
</style> Next Steps
Immediate Actions
After basic setup:
- Create 2-3 test courses with sample content
- Add test user accounts (student, teacher roles)
- Test enrollment workflow from student perspective
- Configure email notifications and test
- Set up automated backups and verify
- Document admin credentials securely
Expansion Ideas
Corporate Training:
- Department-specific course categories
- Compliance tracking and reporting
- Integration with HR systems
- Custom completion certificates
- Manager dashboards
Educational Use:
- Parent portal access
- Grade export to SIS systems
- Plagiarism detection plugins
- Video conferencing integration
- Assignment peer review
Technical Learning:
- Hands-on lab environments
- Integration with code evaluation systems
- Badge and certification programs
- Learning path progression
- Competency-based education
Conclusion
You now have a production-ready Moodle LMS capable of supporting comprehensive learning programs. Moodle’s flexibility allows you to adapt it to virtually any educational or training scenario while maintaining complete control over your data and infrastructure.
Key Achievements
- Self-hosted LMS with unlimited users
- Course creation and content management
- Assessment and grading capabilities
- Mobile app access configured
- Automated backup system
- User and enrollment management
Resources
Official Documentation:
- docs.moodle.org: Complete Moodle documentation
- moodle.org: Community forums and resources
- moodle.org/plugins: Plugin directory
Community Support:
- Moodle forums: Active community assistance
- MoodleCloud: Commercial hosting option
- YouTube: Video tutorials and training
Start by creating a pilot course in your area of expertise, then expand as you become comfortable with Moodle’s powerful features!