Installing Moodle


We have installed Moodle onto the operating system Ubuntu 12.04 for local development. To get moodle running on your system you have to make sure, that you satisfy the following functional requirements:
  • at least 5GB empty disk space and additional same disk space for backup
  • at least 256MB RAM, recommended 1GB or more
  • recommended operationg System Linux Distributions
  • Apache Webserver, MYSQL Server
  • at least PHP 5.4
  • at least Firefox 4, IE 8, Safari 5 , Chrome 11 or Opera 9
Moodle also needs a quite amount of additional PHP packages. These packages are really hard to integrate into the Softwarebundle XAMPP, but are very easy to install on Linux Systems with the Software Center or the Synaptic Package Manager. So here are the packages you have to install first on your System:
  • apache2
  • phpmyadmin
  • mysql-common, mysql-server-5.1, mysql-client
  • libapache2-mod-php5filter
  • php5-cURL
  • php5-mysql
  • php5-xmlrpc
  • php5-intl
Edit: The new version of Moodle 2.7 needs at least php 5.4. You can install php 5.4 over ppa for Ubuntu 12.04/13.3.:
sudo add-apt-repository ppa: ondrej/php5
sudo apt-get update
sudo apt-get install php5

You can check your version of php via:

php -v

After the installation you have to start/restart Apache via:

sudo /etc/init.d/apache2 restart
sudo service apache2 start

Please make sure you don’t have any old processes of Apache still running. You can find out the process PID via:

search for Process ID: ps ax | grep apache2
Kill Processes: sudo kill -9 PID


After preparing your operating system you can simply download the newest moodle release (at the moment: 2.7) from :

and extract it into the var/www/ folder.Give your project an own folder, where you can store the moodle and mahara folder. Moodle will need an own data folder which is not allowed to be in the direct path of moodle, so think about it first.

This Path has to be used in the Configuration of the VHost. We have set up a folder BadgesProject in var/www/, inside of it is the downloaded, extracted folder moodle and we created a folder moodledata.

Additional you have to configure your MySQL-Database Server.  Normaly you just have to type localhost/phpmyadmin into your preferred internetbrowser adressline to get access to the GUI for the Database Server. Login with the Data you configured while installing mysql and make a new Database called moodle_db.

Change into the View Rights and make a new User moodle. Be sure that you choose local for Hosts and mark the Option “Grant all Privileges to Databases beginning with username (username\_%)”. Similary you can just make a database user e.g. moodle with Hosts set to local and choose the Option “make database with same name and grant all privileges “, which is the simplest way.

Then you have to set up the rights on your local system for the project folder and especially for the folders moodle and the yet empty folder moodledata, for example:

sudo chown username : wwwdata moodlefolder
sudo chmod 755 moodlefolder

If everything is configured right, you can navigate with the Browser to your virtual Serveradress e.g. moodle.badges-project.local and moodle will show up for installation. during the installation you will have to create an Admin Account for your Moodle Installation. You will have to remember this!


Setup Virtual Hosts for Mahara and Moodle

The Webserver Apache gives you the Opportunity to setup virtual namebased Hosts for different Projects. If you are working on different projects in your localhost-section, virtual Hosts can help you to organize different projectdata-paths on one IP-Address. Because we also wanted to have the possibility to perhaps install different versions of moodle, we setup a virtual host for both moodle and mahara.


To configure a vHost in Apache2 on a Ubuntu 12.04 System, we only had to insert a new configuration file for each projectfolder inside the folder /etc/apache2/sites-available/ with the following content:


The file badgesproject_moodle.conf

<VirtualHost *:80>
ServerName moodle.badges-project.local
DocumentRoot /var/www/BadgesProject/moodle/
<Directory />
Options FollowSymLinks
AllowOverride None
<Directory /var/www/BadgesProject/moodle/>
Options -Indexes +FollowSymLinks -MultiViews -Includes
AllowOverride All
AcceptPathInfo On
Order allow,deny
allow from all
ErrorLog /var/log/apache2/error-badges.log
CustomLog /var/log/apache2/access-badges.log combined


The file badgesproject_mahara.conf

<VirtualHost *:80>
ServerName mahara.badges-project.local
DocumentRoot /var/www/BadgesProject/mahara/htdocs/
<Directory />
Options FollowSymLinks
AllowOverride None
<Directory /var/www/BadgesProject/mahara/htdocs/>
Options +Indexes +FollowSymLinks +MultiViews +Includes
AllowOverride All
Order allow,deny
allow from all
ErrorLog /var/log/apache2/error-badges-mahara.log
CustomLog /var/log/apache2/access-badges-mahara.log combined


You also define the path to the errorlogs inside of this, so if you are running into problems you can look up these files.


To activate or disable the sites on Apache two administrator commands are available:


activate: a2ensite etc/apache2/sites-available/badgesproject_moodle.conf
disable: a2dissite etc/apache2/sites-available/badgesproject_moodle.conf
always restart apache after this: /etc/init.d/apache2 restart


You can see the enabled sites in the folder: etc/apache2/sites-enabled/.


If you are using the Softwarebundle XAMPP, the configuration files of Apache Server are divided in importable files and you have to uncomment the import of the file httpd-vhosts.conf inside of the main configuration file httpd.conf. You have to define the vHost Configuration content inside of the file httpd-vhosts.conf.


For making the virtual adresses available, you have to configure the hosts file (e.g Linux: /etc/hosts) of your operating system by adding these lines:


::1 moodle.badges-project.local
fe80::1%lo0 moodle.badges-project.local moodle.badges-project.local
::1 mahara.badges-project.local
fe80::1%lo0 mahara.badges-project.local mahara.badges-project.local


Thats all!