4 min read

Moodle Installation Quick Guide

Want to create an interactive learning platform? The first step is to install moodle. In this article, we provide you a quick guide for the moodle installation.
Moodle Installation Quick Guide


Basic Requirements

You will need a working web server (e.g. Apache), a database (e.g. MySQL, MariaDB or PostgreSQL) and have PHP(sometimes known as the LAMP platform) configured. See the release notes in the dev docs for software requirements.

Moodle requires a number of PHP extensions. However, Moodle checks early in the installation process and you can fix the problem and re-start the install script if any are missing.

If you want Moodle to send email (you probably do) you need a working Sendmail (Unix/Linux) on your server or access to an SMTP mail server.


  • Disk space: 200MB for the Moodle code, plus as much as you need to store content. 5GB is probably a realistic minimum.
  • Processor: 1GHz (min), 2GHz dual core or more recommended.
  • Memory: 512MB (min), 1GB or more is recommended. 8GB plus is likely on a large production server
  • Consider separate servers for the web "front ends" and the database. It is much easier to "tune"

How to get moodle

You have two basic options:

Download your required version from http://moodle.org/downloads ...


Pull the code from the Git repository (recommended for developers and also makes upgrading very simple):

git clone -b MOODLE_36_STABLE git://git.moodle.org/moodle.git

This fetches a complete copy of the Moodle repository and then switches to the 3.8 Stable branch.

See Git for Administrators for details on using Git to install Moodle code.

Create Database

Using your chosen database server, create a new empty database. The default encoding must be UTF8. For example, using MySQL:

CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Create a user/password combination with appropriate permissions for the database. For example (MySQL again):


Notes: It is important to GRANT ON moodle.* as the database name including the '.*' and not just the bare database name. Save this password you use for the Moodle user, since you will need it later in the install.

Create moodledata directory

Create an empty directory to hold Moodle files. It must not be in the area served by the web server and must have permissions so that the web server user can write to it. Other than that it can be located anywhere. Typically, either make it owned by the web server user or give it write permissions for 'everyone'. If it is on a shared/NFS drive then read Caching - Moodle caches to this disk area by default and a slow share will mean terrible performance.

Here is an example (Unix/Linux) of creating the directory and setting the permissions for anyone on the server to write here.

# mkdir /path/to/moodledata
# chmod 0777 /path/to/moodledata

Install Moodle code

  • If you downloaded the zip or tgz file earlier, then unzip / untar / move / copy the Moodle code (obtained above) so that it will be served by your web server (e.g. on Debian based Linux, move to /var/www/html/moodle)
  • Check the permissions and make sure that the web server does not have permissions to write to any of the files in the Moodle code directories (a very common root cause of sites being hacked).
  • If you need to, configure your web server to serve the Moodle site with your chosen URL.

Configure Moodle

  • In the Moodle code directory, find the file config-dist.php and copy it to a new file called config.php (but read next step, 'Install Moodle', first).
  • Edit config.php with your favourite editor and change the appropriate settings to point to your site, directories and database. Note: the Moodle install script will create config.php for you if it does not exist but make sure you (re-)set permissions appropriately afterwards.

Install Moodle

  • Go to the URL for your moodle site in a browser (installation will complete automatically) or run the command line version at (requires cli version of PHP):
/usr/bin/php /path/to/moodle/admin/cli/install.php

The CLI creates the config.php for you and will not run if you created one in the previous step.

  • After completing the install make sure your file permissions are ok for the Moodle program files (not writeable by web server) and the Moodle data files (writeable by web server).

Final configuration

Settings within Moodle

There are a number of options within the Moodle Site Administration screens (accessible from the 'Site administration' tab in the 'Administration' block (Classic theme) or the Site administration button in the navigation bar (Boost). Here are a few of the more important ones that you will probably want to check:

  • Administration > Site administration > Server > Email > Outgoing mail configuration: Set your smtp server and authentication if required (so your Moodle site can send emails). You can also set a norepy email on this page.
  • Administration > Site administration > Server > Server > Support contact. Set your support contact email.
  • Administration > Site administration > Server > System paths: Set the paths to du, dot and aspell binaries.
  • Administration > Site administration > Server > HTTP: If you are behind a firewall you may need to set your proxy credentials in the 'Web proxy' section.
  • Administration > Site administration > Location > Update timezones: Run this to make sure your timezone information is up to date.
  • Set server's local timezone inside php.ini (should probably be inside /etc/php.ini or /etc/php.d/date.ini, depending on the underlying OS):
date.timezone = "YOUR LOCAL TIMEZONE"

Installation is complete :)

You can now access Moodle through web browser (using the same URL as you set during the install process), log in as your admin user and try to create a new course.