Learning management systems have become the backbone of modern education, powering everything from K-12 classrooms to corporate training programs and university degree pathways. Platforms like Moodle and Open edX serve millions of learners worldwide, but the vast majority of institutions run these systems on shared hosting or pay steep per-student fees to SaaS providers. Self-hosting your LMS on an Ubuntu VPS gives you complete control over student data, eliminates recurring per-user licensing costs, and lets you customize the platform to match your institution's exact pedagogical needs.

Whether you are a small coding bootcamp with fifty students or a mid-sized university department managing thousands of enrollments, deploying your own LMS infrastructure is more accessible than you might think. With a properly provisioned Ubuntu VPS, a well-tuned LEMP stack, and a disciplined approach to backups and security, you can deliver a learning experience that rivals any hosted solution — at a fraction of the cost. This guide walks you through every step, from choosing the right LMS to scaling for exam-period traffic spikes.

MassiveGRID Ubuntu VPS includes: Ubuntu 24.04 LTS pre-installed · Proxmox HA cluster with automatic failover · Ceph 3x replicated NVMe storage · Independent CPU/RAM/storage scaling · 12 Tbps DDoS protection · 4 global datacenter locations · 100% uptime SLA · 24/7 human support rated 9.5/10

Deploy a self-managed VPS — from $1.99/mo
Need dedicated resources? — from $19.80/mo
Want fully managed hosting? — we handle everything

Why Self-Host an LMS

Third-party LMS providers charge per-student or per-active-user fees that compound quickly as enrollment grows. A university department with 2,000 active students can easily spend $20,000 or more annually on a hosted LMS, and that price only climbs with each new course or semester. Self-hosting eliminates this variable cost entirely — you pay only for infrastructure, which scales predictably.

Beyond cost, there are compelling reasons institutions choose to run their own LMS:

Moodle vs Open edX vs Canvas: Choosing Your Platform

The three dominant open-source LMS platforms each serve different use cases. Understanding their resource requirements and strengths helps you choose the right one for your institution and provision appropriate infrastructure.

Feature Moodle Open edX Canvas (Open Source)
Primary use case K-12, universities, corporate training MOOCs, large-scale online courses Higher education, K-12
Language / stack PHP / MySQL or PostgreSQL Python (Django) / MongoDB + MySQL Ruby on Rails / PostgreSQL
Minimum VPS resources 2 vCPU / 4 GB RAM 8 vCPU / 16 GB RAM 4 vCPU / 8 GB RAM
Recommended for 500 users 4 vCPU / 8 GB RAM 8 vCPU / 32 GB RAM 4 vCPU / 16 GB RAM
Deployment complexity Low — standard LEMP stack High — Docker-based, multiple services Medium — Ruby environment setup
Plugin ecosystem 2,000+ plugins XBlocks (moderate ecosystem) LTI integrations
SCORM support Native Via XBlock Native
Mobile apps Official Moodle app Official mobile apps Official Canvas app
License GPLv3 AGPLv3 AGPLv3

For most small-to-mid-size deployments, Moodle offers the best balance of low resource requirements, extensive plugin ecosystem, and straightforward deployment on a standard LEMP stack. Open edX is the better choice for MOOC-style courses with thousands of concurrent learners, but requires significantly more infrastructure. This guide covers both, starting with Moodle.

Data Residency for Student Data: FERPA and GDPR Compliance

Where your LMS server is physically located matters for regulatory compliance. Student data is protected under strict privacy frameworks, and hosting in the wrong jurisdiction can create legal liability for your institution.

MassiveGRID offers both locations along with London and Singapore, so you can place your LMS infrastructure in the jurisdiction that aligns with your institution's regulatory requirements. For institutions serving students across multiple regions, consider deploying separate instances in each relevant datacenter.

Deploying Moodle on Ubuntu VPS: Prerequisites

Moodle runs on a standard LEMP stack (Linux, Nginx, MySQL/MariaDB, PHP). Before installing Moodle itself, you need a properly configured web server environment. If you have not already set up your LEMP stack, follow our comprehensive guide first:

Install LEMP Stack on Ubuntu VPS

For a Moodle deployment serving up to 100 concurrent users, provision your VPS with at least:

Ensure the following PHP extensions are installed, as Moodle requires them:

sudo apt install php8.3-fpm php8.3-mysql php8.3-xml php8.3-mbstring \
  php8.3-curl php8.3-zip php8.3-gd php8.3-intl php8.3-soap \
  php8.3-xmlrpc php8.3-opcache php8.3-redis

You will also need a database server. MariaDB is the recommended choice for Moodle on Ubuntu:

sudo apt install mariadb-server mariadb-client
sudo mysql_secure_installation

Create the Moodle database and user:

sudo mysql -u root -p

CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'moodleuser'@'localhost' IDENTIFIED BY 'your_secure_password_here';
GRANT ALL PRIVILEGES ON moodle.* TO 'moodleuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Moodle Installation and Configuration

With your LEMP stack and database ready, download and install Moodle. Always use the latest stable branch from the official Git repository:

cd /var/www
sudo git clone -b MOODLE_404_STABLE git://git.moodle.org/moodle.git
sudo mkdir -p /var/moodledata
sudo chown -R www-data:www-data /var/www/moodle /var/moodledata
sudo chmod -R 755 /var/www/moodle /var/moodledata

The /var/moodledata directory stores uploaded files, session data, and cache. It must be outside the web root for security and writable by the web server process.

Configure your Nginx server block for Moodle:

server {
    listen 80;
    server_name lms.yourdomain.com;
    root /var/www/moodle;
    index index.php;

    client_max_body_size 256M;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_read_timeout 300;
    }

    location /dataroot/ {
        internal;
        alias /var/moodledata/;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
        expires 30d;
        add_header Cache-Control "public, immutable";
    }
}

Test and reload Nginx:

sudo nginx -t
sudo systemctl reload nginx

Navigate to http://lms.yourdomain.com in your browser to launch the Moodle web installer. The wizard will guide you through database configuration, admin account creation, and initial site settings. Once complete, configure cron for Moodle's scheduled tasks:

echo "* * * * * www-data /usr/bin/php /var/www/moodle/admin/cli/cron.php > /dev/null 2>&1" | sudo tee /etc/cron.d/moodle

This runs Moodle's cron every minute, which processes email queues, calculates grades, cleans up sessions, and handles scheduled task execution.