Setting up a Moodle Development Environment with Cloud9 IDE

Cloud9 is a cloud based development environment. Behind the scenes it uses Docker containers to provide an awesome IDE together with a Workspace using Ubuntu. What this means it that you can you set up a fully integrated Moodle development environment on Cloud9!

This tutorial uses Moodle 3.1 for because as of May 2017 Cloud9 ships by default with PHP 5.5.9 which doesn’t meet the minimum requirements for Moodle 3.2 ( You can work around this but it is more involved so for now, lets stick with Moodle 3.1.

To start with, signup for a new (free account). Note while the account is free, it will require you to enter a credit card just to verify your identity.

Once you have an account and have logged in, add a new Workspace.

  • Enter your workspace name (e.g. Moodle)
  • A description e.g. Moodle 3.1 Development Environment
  • Choose Private (you get one free private workspace) or public
  • Choose a template and select PHP, APache & MySQL
  • Create your workspace

Note most of the steps that follow are just regular linux commands and set up instructions for installing Moodle.
Nothing particularly specific to Cloud9, but there are a few instances where the commands vary slighly e.g. for accessing the MySQL CLI.

Cloning Moodle via Git

Once you see your IDE, go to the terminal at the bottom. The first step is to clone moodle via git.

You should be in ~/workspace (if not cd ~/workspace).

git clone git:// moodle

This will clone it to ~/workspace/moodle

Once finished, checkout the MOODLE_31_STABLE branch

git checkout MOODLE_31_STABLE

Now we want to move everything in moodle to the ~/workspace folder as that is the base directory used when you choose Run Project.

cd ~/workspace/moodle
mv * ../
mv .* ../
cd ..
rmdir moodle

Note you will see the following message which can be ignored. Its just to get all the .* files into the workspace folder.

mv: cannot move ‘.’ to ‘../.’: Device or resource busy
mv: cannot move ‘..’ to ‘../..’: Device or resource busy

Now you have everything that was cloned in~/workspace/moodle in the ~/workspace folder and it should show you are in the MOODLE_31_STABLE branch

<user>~/workspace (MOODLE_31_STABLE) $ 

Setting up the Database

Next we need to set up a MySQL database. In the terminal type:

mysql-ctl cli

Note you may need to type mysql-ctl install if it is not already installed

Create your moodle database, user and give the user full access to the database.

mysql> create database moodle character set utf8 collate utf8_general_ci;
mysql> create user moodle@localhost identified by 'moodle';
mysql> grant all on moodle.* to moodle@localhost;

mysql> exit

Setting up the data directory

We’ll put this under ~/moodledata
Create this directory:

mkdir ~/moodledata

( Note you could do this via the file manager on the left hand side of the IDE if you click on the small cog in the left pane and choose “Show Home in Favourites”. )

Install Moodle

Ok, you are ready to hit “Run Project” to fire up Apache & PHP.
This will open in a new tab and give you a URL to where it is serving e.g.

Go ahead and visit that page or click on the link and choose open. Hopefully you see the Moodle installation screen. Note on the first few screens before the license the stylesheet/layout won’t look great, but it will sort itself out later on.

Follow the prompts:

  • Pick your language
  • Your web address, Moodle directory (workspace) and Data directory (moodledata) should all default
  • Database drive is MySQL (native/mysqli)
  • Database host is localhost (default) name is moodle (default) enter user as moodle and password as moodle and choose next (prefix/port/socket all stay at defaults).
  • You should see the installation screen and license, choose continue.
  • All server checks should pass, so choose continue
  • The installation will take a while, let it run through. When finished you will see a continue button on the bottom of the page (may need to scroll to the end).
  • When finished you should see a screen where you can set up your admin user account. Make sure you enter a valid email here.
  • Finally you can enter your front page settings; the full site name e.g. Moodle 3.1 Development Environment and short name e.g. moodle31dev. Update your timezone and save.

That’s it, you have a working Moodle 3.1.x environment that you can now development against with the Cloud 9 IDE!


Moodle Tips


Leave a Reply

Your email address will not be published. Required fields are marked *