Installing Moodle on localhost
Install the open-source Learning Management System (LMS) Moodle locally to set up an online course and testing environment at http://localhost/moodle.
Moodle is the most widely used open-source LMS (Learning Management System) globally, utilized for online schools, corporate training, and online courses. Local installation allows for the development of plugins, themes, and course content.
Prerequisites
- PHP 8.0+ (refer to Moodle version requirements)
- MySQL/MariaDB or PostgreSQL
- Extensions:
xmlrpc,intl,zip,gd,soap, etc. (the installer will check) - The data directory
moodledatamust be writable by the web server and not accessible via URL
Installation Steps
- Download the stable version from moodle.org
- Extract to
htdocs/moodle/ - Create a data directory outside the web root, for example:
- Windows:
C:\moodledata - Linux/macOS:
/var/moodledata(permissions set towww-data)
- Windows:
- Create a database
moodle_localin phpMyAdmin with character setutf8mb4 - Access http://localhost/moodle
- Fill in the installation wizard with wwwroot, data directory path, and database information
Key Configuration
| Item | Example |
|---|---|
| Web Address | http://localhost/moodle |
| Data Directory | /var/moodledata (absolute path) |
| Database Host | localhost |
Common Paths
| Path | Description |
|---|---|
/moodle | Site homepage / Login |
/moodle/admin | Administration |
/moodle/course | Course list |
/moodle/mod/ | Activity modules |
Local Development
- Enable debugging: Site administration → Development → Debugging messages
- Plugin types: Activity modules, blocks, themes, local plugins, etc.
- After upgrading, access
/admin/index.phpto run database upgrades
Frequently Asked Questions
Data directory not writable
Check OS permissions; do not place the path inside htdocs to avoid being downloaded.
Cron jobs
Configure cron for production; for local development, you can manually access /admin/cron.php.
Missing PHP extensions
The installation interface lists all missing items; enable them in XAMPP’s php.ini.
Summary
The local address for Moodle is http://localhost/moodle, requiring a standalone writable moodledata directory and complete PHP extensions, suitable for LMS and online course development.