Windows installation using Git

From MoodleDocs
Revision as of 13:51, 2 December 2013 by Gareth Barnard (talk | contribs) (→‎Getting hold of Moodle)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page is for non-technical Windows users who would like to be able to keep a copy of Moodle on their computers that they can easily and regularly update.

NOTE: These guidelines are intended for a Standard Moodle installation on a Windows PC for a private or test Moodle installation, NOT a production (public) site or service. If you wish to install Moodle on a public site using Git then please see Git for Administrators. If you wish to contribute fixes or improvements using Git please see Development: Git for developers

If you prefer screencasts to reading, there is a youtube tutorial here

What you need to install Moodle on your Windows pc

  1. somewhere on your pc to house it and keep it working,with a database to maintain its records. We will use WAMP server
  2. the Moodle files themselves. We will use Github for Windows

What is Git and why use it?

Git allows Moodlers not only to quickly download the latest versions of Moodle but also to

Git cycle

download and test out fixes by developers and to share with others their own changes which may potentially get integrated into Moodle for the benefit of everyone. In this page we are merely going to use the system to download Moodle onto our computer- (see the cycle in yellow in the screenshot)Git makes it easy for us to update Moodle when new versions come out each week, and it gives you the potential when more familiar with it to grab other changes and help test it. However, if you merely want to have Moodle on your Windows pc to practise and try things out and are NOT really interested in having all the latest changes then it might be easier for you to use the All in one Windows Installer package instead.

Getting the WAMP server

path to your wamp folder

1. Go to Wampserver and click the Download button

2. You will probably need to click the button Wampserver (64 bits &PHP 5.3) 2.2E but to be sure, here is how to check if your pc is 64 bit or 32 bit)

3. You may get a warning You must install Visual C++ 2010 SP1 Redistributable Package x86 or x64 - download the appropriate package for you. This may take some time.

4. When it is done, come back to Wampserver and click the Download button again. Download, save and run the program, making sure you keep a note of where it has installed it on your computer. It will be in a folder called wamp. as in the screenshot to the left.

Making the database

Once wampserver is installed you will see a W icon, either on your desktop, start menu or taskbar (according to what you selected when installing.) Click it to bring up its options and then click PhpMyadmin as in Screenshot A below.

Tip: You can also reach this screen by typing into your browser: http://localhost/phpmyadmin/

1.Make sure that Server connection collation says "utf8_general_ci" (1 in Screenshot B below)

2.Click "databases" - (2 in Screenshot B below)

Screenshot A
Screenshot B

3. Type a name for your database (how about "moodle"?) Make sure you remember its name. Ensure Collation is set to utf8_general-ci. Click "Create". create database.png

4.Click the "check privileges" to the right of your database name and then click "add user".

5. Add your details as the database administrator. Choose "local" for the host Make sure you remember the name and password you set. Tick (check) all privileges and click "add user".

Preparing to install Moodle

Where Moodle and Moodledata go

Along with the folder containing all the Moodle files, we need another folder to hold all the user data once Moodle is up and running. This is traditionally called the "moodledata" folder. We need to create a new folder for this before downloading Moodle.


  1. Find your wampserver on your computer - for instance, in C:\wamp.
  2. Note there is a folder called "www". We will install Moodle into there.
  3. If you wish, create a new folder called "moodledata" in the wampserver folder, as in the screenshot - but if not, Moodle will create it for you and suggest its name.

Getting hold of Git

  1. Go to Github for Windows and click the download button (currently in green, top right)
  2. You don't need to make an account but if you do, it will help you later if you wish to use Git at a more advanced level.
  3. Let Windows do its work; save it and run it. It might take some time.
  4. Once it is installed, you will have two cat-like creature icons on your desktop, taskbar or start menu (depending on what you selected)
  5. Click the one called "Git shell". It will bring up a black box:

Git shell


Getting hold of Moodle

The file path shown in your black box ("Windows power shell") is where Git has made your personal repository. You can download Moodle into there if you wish, but you will then have to copy the Moodle folder into your wampserver directory. Instead, we will download Moodle straight into the www folder of our wampserver directory.

1. Type cd C:\wamp\www (or whatever the path is to your wampserver directory and where you want to put Moodle)

2. Type git clone -b MOODLE_26_STABLE git://git.moodle.org/moodle.git (If you want a different version, see the #Troubleshooting and FAQ below.)

3. Wait! Lots of lines will appear and it might take a while. At the end you should see "Checking out files:100% done"

Step 1
Step2
Step3

Installing Moodle

  1. In your browser, type localhost/moodle
  2. The Moodle set up screen will appear.
  3. Much of this is straightforward form-filling. Pay attention to:
    1. the paths -does it know where to find your wampserver folder for Moodle and moodledata?
    2. the database details (which you should have remembered when setting up in section 4 above)
    3. the server check.
Check correct paths
Database details
Server check

What are server checks?

Moodle needs to ensure our wampserver has all the features ("extensions") enabled to run it successfully.

Anything in green is fine. Anything in yellow is OK (but would be better in green). Anything in red will stop us installing Moodle.

  1. Make a note of the ones in yellow or red (names are under the Information column)
  2. Click your W wampserver icon and click "php extensions" (screenshot 1 below)
  3. Tick those extensions you noted were yellow or red (screenshot 2 below)
Php extensions 1
Php extensions 2

Note: If you have problems enabling the curl extension, see the #Troubleshooting and FAQ below.

Completing the installation

  1. Once your server checks page shows all green or all green with some yellow, you can click "Continue"
  2. Moodle will install - this will take some time. Be patient. When you see "workshop" you know you are nearly done.
  3. Complete details for your admin username and password (and remember them!)
  4. Complete details for your front page (name of your Moodle, etc)
  5. Give yourself a pat on the back!

Updating your Moodle

You can get a newer version of Moodle every Thursday. To do this using Git:

  1. Click the Git shell avatar to open up the Windows powershell black box.
  2. If it shows a different directory from where you installed Moodle, change the path by typing in C:\wamp\www\moodle or wherever the path to your Moodle folder is.
  3. You will see it now displays the name of the Moodle version you installed (Screenshot 1 below)
  4. Type git pull
  5. Lines will appear and your Moodle will update itself automatically!(Screenshot 2 below)
  6. Note that git pull will also tell you if your version is currently up to date (Screenshot 3 below)
1: Moodle folder ready for update
2: Moodle has been updated
3: Currently up to date

Troubleshooting and FAQ

I can't get cURL extension to green (or even yellow) whatever I try.

It could be your downloaded wampserver had a corrupted cURL extension (mine did). Go to mediafire.com and download the cURL extenstion there. Unzip it and then add it into (for example) wamp>bin>php>php 5.3.13>ext. (The exact path will depend on where you saved your wampserver.) Let it override the original and try again.

I type localhost/moodle but it doesn't work!

Make sure your wampserver is working ("online") The W icon should be green. If it isn't, then click it and click "restart all services" or "start all services" and try again.

I want a different version of Moodle

If you want an earlier version such as Moodle 2.2 then type git clone -b MOODLE_22_STABLE git://git.moodle.org/moodle.git

If you want the latest, non-stable, development version of Moodle (currently 2.4) then type git clone git://git.moodle.org/moodle.git

I want Moodle in localhost and NOT localhost/moodle

In the #Getting hold of Moodle section, make sure your path does not include "www". It might be for instance "C:\wamp". Moodle will then download directly into your wampserver directory. Rename your "www" folder to "wwwOLD" and then rename your newly arrived moodle folder to "www".

See also

Video tutorial on youtube

Using Moodle forum thread Git for Dummies