Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Install Moodle on Your Server via Web Browser

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can install Moodle entirely from your web browser after preparing the server. The web installer walks you through database setup, configuration, and initial site creation. Before you start, you need a server (or local machine) with a web server (Apache or Nginx), PHP (version 7.4 or higher, 8.1 recommended), and a database (MySQL, MariaDB, or PostgreSQL) already installed and running. You also need the Moodle source code downloaded and placed in your web root, and you must know your database credentials.

What You'll Need

  • A server (could be a VPS, dedicated server, or even your own computer) with Linux, Windows, or macOS.
  • Web server software: Apache or Nginx, with PHP support.
  • PHP version 7.4 or newer, with required extensions (e.g., intl, curl, zip, gd, xmlrpc, mbstring).
  • A database server: MySQL 8.0+, MariaDB 10.2.2+, or PostgreSQL 12+.
  • The Moodle installation package (downloaded from moodle.org) extracted into your web root directory.
  • Database name, username, and password (you may need to create these beforehand).
  • Web browser on any device that can reach the server's URL.

Step-by-Step

  1. Download Moodle – Go to moodle.org/download and get the latest stable version. Choose the appropriate package (e.g., moodle-latest-XXX.tgz for Linux, or .zip for Windows).
  2. Upload and extract – Upload the archive to your server (e.g., via SFTP or SCP). Extract it into your web root. For example, on Linux with Apache, the web root is often /var/www/html. Extract so that the Moodle files are directly inside that folder (e.g., /var/www/html/moodle).
  3. Create a data directory – Moodle needs a separate directory to store files (e.g., /var/moodledata). This directory must NOT be accessible via the web. Create it and set permissions so the web server can read/write to it. On Linux: mkdir /var/moodledata and chown www-data:www-data /var/moodledata (replace www-data with your web server user).
  4. Set file permissions – Ensure the Moodle code directory is readable and writable by the web server user. On Linux: chown -R www-data:www-data /var/www/html/moodle and chmod -R 755 /var/www/html/moodle.
  5. Open the installer in your browser – In your web browser, go to your server's URL pointing to the Moodle directory. For example, if your server IP is 192.168.1.10 and Moodle is in /moodle, visit http://192.168.1.10/moodle. The installer will start automatically.
  6. Choose language – Select your preferred language and click “Next”.
  7. Confirm paths – The installer will show the web root and data directory paths. Verify they are correct (the data directory should be the one you created). Click “Next”.
  8. Select database driver – Choose the database type you are using (e.g., MySQL Improved, MariaDB, or PostgreSQL). Click “Next”.
  9. Enter database settings – Provide the database host (usually “localhost”), database name, user, password, and optionally a table prefix (default is “mdl_”). If you haven't created the database yet, you can do it now via the command line or a tool like phpMyAdmin. Click “Next”.
  10. Review copyright notice – Read the GNU GPL license and click “Continue”.
  11. Check server requirements – The installer will run a series of checks. If any fail, you'll see a message. You can often fix missing PHP extensions or settings. Click “Continue” when all checks pass.
  12. Set up the admin account – Fill in the administrator username, password, email, and other details. Click “Update profile” or “Save”.
  13. Configure site settings – Enter your site's full name, short name, timezone, and other defaults. Click “Save changes”.
  14. Finish installation – The installer will complete the setup and show a success page. You can then log in with your admin account and start using Moodle.

Common Mistakes

  • Data directory inside web root – Placing the data directory where it can be accessed via the browser is a security risk. Always keep it outside the public HTML folder.
  • Incorrect file permissions – If the web server can't write to the Moodle code directory, the installer may fail with “Can't create configuration file”. Ensure the web server user owns the directory.
  • Wrong database credentials – Double-check the database name, user, and password. A common mistake is using the MySQL root password instead of a dedicated user.
  • Missing PHP extensions – The installer will complain if required extensions are missing. Install them via your package manager (e.g., apt install php-intl on Debian/Ubuntu) or enable them in php.ini.
  • Using the wrong PHP version – Older PHP versions like 5.x are not supported. Verify your PHP version with php -v.

Tips

  • Before starting, back up your server (or at least the database) if it's a production environment.
  • Use a dedicated database user with privileges only on the Moodle database, not the root user.
  • If you're on a shared hosting plan, the installer may not have all required extensions. Check with your host first.
  • After installation, delete the install.php file or restrict access to it for security.
  • Set up SSL (HTTPS) before going live to protect login credentials.

Troubleshooting

If the installer doesn't start, or you get errors, try these in order:

  1. Check the URL – Make sure you're visiting the correct path. If you placed Moodle in a subdirectory, include it in the URL.
  2. Check web server error logs – Look at Apache or Nginx logs (e.g., /var/log/apache2/error.log) for PHP errors or file permission issues.
  3. Verify PHP is installed – Create a test file phpinfo.php with <?php phpinfo(); ?> and open it in the browser. If you see the PHP info, PHP works; if not, install or start PHP.
  4. Check that the database server is running – Use systemctl status mysql (or mariadb) to confirm the service is active.
  5. Re-upload the Moodle files – If you see missing files or a “not found” error, the extraction may have failed. Re-extract the archive.
  6. If you get a “Can't connect to database” error – Verify the database host (often “localhost”), port, and credentials. Try connecting from the command line: mysql -u username -p.
  7. If the installer gets stuck at a step – Clear your browser cache and cookies, then restart the installer by deleting the config.php file if it was partially created.
  8. If you see a blank page – Enable PHP error display temporarily: edit php.ini and set display_errors = On, then restart the web server.

Frequently Asked Questions

Can I install Moodle on a shared hosting account?

Yes, if the host meets the requirements (PHP version, extensions, database). Many shared hosts support Moodle, but you may need to ask them to enable specific extensions.

Do I need to know command line to install Moodle?

No, the web installer is graphical. However, you may need command line for initial file upload and permission changes if you don't have a file manager in your hosting control panel.

What is the data directory for?

It stores uploaded files, cache, sessions, and other runtime data. It must be outside the web root for security.

Can I use SQLite instead of MySQL?

Moodle supports SQLite, but it's not recommended for production. Use MySQL, MariaDB, or PostgreSQL for better performance and reliability.

How do I update Moodle after installation?

You can update via the web interface (Site administration > Notifications) after replacing the code files with the newer version. Always backup first.

What if I forget the admin password?

You can reset it via the command line using the admin/cli/reset_password.php script, or by using a PHP script that updates the user table. Contact your server admin if needed.