Part 8 - Install Moodle
- Download the latest Moodle Generic package (zip package) from download.moodle.org. This page has various different versions and builds. You should download the .zip archive at the top of the list. It's called "Latest Stable Build" - and that's exactly what it is! And, like the information box says, it's the best choice for a new server.
Note
There is a Windows installer package available but you're on your own using it. I've only used it once and it convinced me that installing Moodle manually is the best way to go. This XAMPP package is not designed for production servers.
- Extract the .zip archive to the folder where you want Moodle to run from, e.g. your root folder C:\. Once uncompressed the entire Moodle application will be in a folder called "Moodle" in the directory that you specify, e.g. C:\Moodle if you specified C:\ as the installation directory. As a personal preference and for security reasons I do not install Moodle in the C:\inetpub\wwwroot folder.
Note
The location that you should extract the .zip archive to will depend on how you want users to access Moodle on the server. Refer to the instructions for installing Moodle on a dedicated or shared server in Part 4.
- Make a copy of the config-dist.php file in the C:\Moodle folder and rename it to config.php.
- Create a Moodle data directory e.g. C:\MoodleData. This is where Moodle will save all the files that you upload, such as course documents and user pictures.
Note
For security reasons the Moodledata folder should be outside your web root. In other words, you should put your Moodledata folder where it is not directly accessible via the web. This will ensure that malicious users will not be able to access your Moodle content.
- Setup the config.php file by changing these parameters:
- Set $CFG->dbtype to 'mssql_n': $CFG->dbtype = 'mssql_n';
- Set $CFG->dbhost to your MSSQL database host, e.g.: $CFG->dbhost = 'your_db_host';
- Set $CFG->dbname to your MSSQL database name, e.g.: $CFG->dbname = 'your_db_name';
- Set $CFG->dbuser to your database user name, e.g.: $CFG->dbuser = 'mdl_user';
- Set $CFG->dbpass to your database password, e.g.: $CFG->dbpass = 'your_db_password';
- Keep the default $CFG->prefix value: $CFG->prefix = 'mdl_';
- Keep the default $CFG->dbpersist value: $CFG->dbpersist = false;
- Set $CFG->wwwroot to the full web address where moodle has been installed, e.g.: $CFG->wwwroot = 'http://yourmoodlehost/moodle';
- Set $CFG->dirroot to the path where you installed Moodle, e.g.: $CFG->dirroot = 'C:\moodle';
- Set $CFG->dataroot to the path of your Moodle data folder, e.g.: $CFG->dataroot = 'C:\moodledata';. For security reasons this should be outside your web root.
- Set $CFG->emailconnectionerrorsto to the e-mail address of your Moodle administrator, e.g.: $CFG->emailconnectionerrorsto = 'admin@yourhost.com'. This setting is optional and you should set it only if you want the administrator to receive e-mail notifications of database connection failures.
- Finally, make absolutely sure that there no spaces, blank lines, returns, or anything else at the end of the config.php file. The very last characters in the page must be the closing PHP characters: ?>
Don't add or allow a blank line or carriage return after these characters.
Note
If you don't create a config.php file Moodle will prompt you for the required values when you run the Moodle setup and then create the config.php file for you. However, it will not contain all the information and notes that the config-dist.php contains and these notes can be quite valuable, especially when you are troubleshooting. So I highly recommend that you make your own config.php file from the config-dist.php as per Step 3 above.
- Run the Moodle installation by pointing your browser at the install.php script on your Moodle site: e.g. http://yourmoodlesite.com/install.php. Moodle gives you the option to run an unattended installation but you should not select this option because it's better to check the output of each of the installlation steps that Moodle performs so that you can look out for any errors during the Moodle installation (e.g. permissions errors).
- When the installation scripts have run and all the database tables have been created Moodle will prompt you to enter the administrator username, password and the administrators details. For maximum security use a unique name for the administreator instead of 'Admin' or 'Administrator'.
- When the adminstrator account has been created and the Moodle setup is complete login to the Moodle site and test if it is working. If you installed Moodle in the IIS root the url will be: http://yourmoodlesite.com. If you installed it in a subfolder in the root called 'moodle' then it will be: http://yourmoodlesite.com/moodle.
- Run the Moodle Health Check. This is the health.php file in the Moodle \admin folder and you call it like this: http://yourmoodlesite.com/admin/health.php. This script will check your Moodle setup and alert you to any problems.
- To check how your server suits the current and future Moodle installation requirements use the Environment function under the Server folder in your Site Administration block.
Your Moodle site is now setup. The next step is to setup a cron script.