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 moodledata must be writable by the web server and not accessible via URL

Installation Steps

  1. Download the stable version from moodle.org
  2. Extract to htdocs/moodle/
  3. Create a data directory outside the web root, for example:
    • Windows: C:\moodledata
    • Linux/macOS: /var/moodledata (permissions set to www-data)
  4. Create a database moodle_local in phpMyAdmin with character set utf8mb4
  5. Access http://localhost/moodle
  6. Fill in the installation wizard with wwwroot, data directory path, and database information

Key Configuration

ItemExample
Web Addresshttp://localhost/moodle
Data Directory/var/moodledata (absolute path)
Database Hostlocalhost

Common Paths

PathDescription
/moodleSite homepage / Login
/moodle/adminAdministration
/moodle/courseCourse 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.php to 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.

访客计数:------ Best viewed in Netscape Navigator · 800×600 © LocalHost Run