## Index → Cookbook

## Cookbook: Setting up Moodle

Running Moodle on Cherokee is easy to do. Since Moodle has relatively high requirements (1GB RAM is recommended), it is actually a very good idea to run a high performance web server and see how things simply start flying.

The only software requirements are a web server, MySQL and PHP with several extensions. You can see the complete list of software requirements at Moodle’s site. Don’t worry about this point. The installer will detail exactly what are the missing modules, soy you can install whatever you need during that part of the process.

Cherokee can be configured in a breeze thanks to the provided Moodle Wizard.

### Configure Cherokee using the Wizard

#### Setting up Moodle as a new Virtual Server

The first step would be to go to the virtual server list page. Once in there, you’ll have to click the `Wizards` button:

Then, select the `Misc` category, run the Moodle wizard and you are good to go.

Feel free to manually tune whatever parameters you see fit, but no more intervention is needed.

#### Setting up Moodle inside a Directory

Moodle can also be configured inside a directory. Let’s suppose we want to set up Moodle inside the `/course` directory of one of our virtual servers.

In this case, the first thing you will have to do is to enter the virtual server configuration you’d like to configure Moodle in. Once in there, click on the rule addition button and choose the `Moodle` wizard.

As in the previous case, this wizard will ask some very basic information, including the public web directory where Moodle will be set up and the local Moodle source directory.

### Setting up Moodle

Of course, you will need to download Moodle from the download site if you don’t already have a copy.

For this example we will be using moodle-weekly-19, which is the recommended option at the time of writing.

Uncompress it to a directory of your choice, like `/var/www/moodle`, and remember changing ownership to that of the user under which Cherokee will be running.

First download and uncompress the distributed Moodle release into `/var/www/moodle`, and create a database suitable for the installation.

Log in to MySQL:

    mysql -u root -p

And create the database for Moodle. We will be using the name moodle, the user moodleuser and the password moodlepassword, but you should set up your own.

    CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    GRANT ALL PRIVILEGES ON moodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepassword';
    GRANT ALL PRIVILEGES ON moodle.* TO moodleuser@localhost.localdomain IDENTIFIED BY 'moodlepassword';
    FLUSH PRIVILEGES;
    quit;

You will also have to create a directory for Moodle to save data in it. It must be outside the web document tree.

    mkdir /var/www/moodledata
    chmod 0770 moodledata
    chown www-data:www-data moodledata

Then point your web browser to `http://localhost` and follow the instructions provided by the installer. You will only need to provide the above mentioned database information and very little else.

Installation paths
Database settings

As mentioned before, checks will be performed to see if the needed PHP modules are available. Make sure to have the ones you’ll be needing.

PHP requirements

This will get you through the whole installation process in around 20 little extra steps give or take. Just click on `continue` and you should be fine. It will populate your database and get you through the whole installation process.

Moodle in action

Once you are done, don’t forget to set up your cron tasks and configure the backup settings. You can find all the information to create new courses and everything else there is to know in Moodle’s documentation.

### Setting up Cherokee manually

Using the wizard is the recommended option to set up Moodle on Cherokee. However, should you wish to do it manually you will just need PHP support correctly configured in Cherokee. Please refer to the PHP Wizard or to the pertaining documentation section about setting up PHP in case you don’t have it available for some reason.

Besides the PHP requirement, nothing else is needed.

Simply set the `Document root` to `/var/www/moodle` and you are ready to go. This is done within the `Basics` tab of the chosen `Virtual Server`.