Moodle tips


Revision as of 23:16, 7 February 2012 by Perspectoff (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Moodle tips

Prepare your server

  • Moodle is meant to be run on a server. It requires Apache2, the PHP scripting language, and a database (either MySQL or postgreSQL). While many users feel postgreSQL is a better database, MySQL is more widely used and is easier for first time users (since there are many integrated packages that use it). A LAMP server (Linux, Apache2, MySQL, PHP) can easily be installed:
sudo apt-get install tasksel
sudo tasksel install lamp-server

When installing the LAMP server, note the MySQL root password carefully. This will be required during Moodle installation.

  • Moodle must know where the server is located. (You must also have a way for other users to reach it.) The FQDN (Fully Qualified Domain Name) refers to the location of the server on which the Moodle database is located. In general, there are two options: localhost (meaning the database will be located on the same computer on which Moodle will be installed) or a URL. (Of course, the URL could still refer to the same computer).

Don't worry, whichever option you choose can be changed later. For initial installation, it is easiest to use localhost as the FQDN (and also wherever it is available as an installation option).


Moodle is a free open source platform for hosting online learning courses. It can be integrated with webinar software. A LAMP server installation is required (sudo tasksel install lamp-server). Also find free Moodle themes here. Install:

sudo apt-get install moodle
  • Database server software for Moodle: mysql-server -> follow remainder of instructions. Assuming the database is hosted on the same computer as the one Moodle is being installed upon, accept localhost for the options when prompted.
  • Edit Moodle configuration options (if needed). (Use the gedit text editor instead of kate if using Ubuntu instead of Kubuntu.):
sudo kate /etc/moodle/config.php
  • Edit Moodle apache2 configuration file (if needed). (Use the gedit text editor instead of kate if using Ubuntu instead of Kubuntu.):
sudo kate /etc/moodle/apache.conf
  • Finish installation through the browser. (I recommend the "unattended" installation.)

Set up a virtual server

The whole point of Moodle is that users can access it over a network. The easiest way is to set up a URL for your server so that users can reach Moodle using the URL. Several steps are necessary.

  • If you have a router on your network, forward incoming traffic on ports 80 and 443 (http and https) from the router to the (static) LAN IP address of the server hosting Moodle.
  • The firewall on the Moodle server should allow all incoming traffic on ports 80 and 443.
  • A URL for your Moodle site should have been established with a DNS name server on the Internet. It is possible to use a Dynamic DNS server, as well. An example URL is
  • A virtual host file in /etc/apache2/sites-available must be created for Moodle.
cd /etc/apache2/sites-available
sudo cp default moodlevirtualhost
It should be edited (sudo gedit /etc/apache2/sites-available/moodlevirtualhost) to look like
<VirtualHost *:80>
DocumentRoot /usr/share/moodle/
#RewriteEngine On
#RewriteOptions inherit

Notes: The Rewrite options are listed here only for forward compatibility with Apache rewrite rules. They are only used for multi-site installations and can, in general, remain commented out (with the #).

  • The virtual host file should be linked to /etc/apache2/sites-enabled and apache2 restarted (sudo etc/init.d/apache2 restart).
sudo ln -s /etc/apache2/sites-available/moodlevirtualhost /etc/apache2/sites-enabled
  • Edit the /etc/moodle/config.php file (sudo gedit /etc/moodle/config.php) so that the FQDN (in this case the URL) is correctly noted.
$CFG->wwwroot = '';
  • Login to the Moodle server:

Using Moodle with an existing URL

It is possible to use Moodle with an existing URL. If, for example, you already have a server at, it is possible to use Moodle at the URL

In such a situation, no additional virtual host file needs to be created for Moodle; the virtual host file for the existing server is sufficient.

This is possible because the /etc/moodle/apache.conf file contains the line

Alias /moodle /usr/share/moodle/

and traffic to the host server will therefore be forwarded accordingly.

  • Edit the /etc/moodle/config.php file (sudo kate /etc/moodle/config.php) so that the FQDN (in this case the URL) is correctly noted.
$CFG->wwwroot = '';
  • Login to the Moodle server:

Add a custom theme to Moodle

  • Download one. Extract the zip file (by clicking on the filename in Nautilus, for example).
  • Copy the extracted folder to /usr/share/moodle/theme
  • From Moodle, install the new theme:
Moodle -> Appearance -> Themes -> Theme Selector
  • Copy a custom footer logo (ideal size 55px x 55px) to /etc/moodle and name it moodlelogo55.png. Link this file to the Moodle pix folder:
sudo ln -s /etc/moodle/moodlelogo55.png /usr/share/moodle/pix
  • The front page footer logo can then be changed by editing:
sudo nano /usr/share/moodle/lib/weblib.php

and editing the $homelink values from

$homelink  = '<div class="sitelink">'.
               '<a title="Moodle '. $CFG->release .'" href="">'.
               '<img style="width:100px;height:30px" src="pix/moodlelogo.gif" alt="moodlelogo" /></a></div>';
 $homelink  = '<div class="sitelink">'.
               '<a title="My Home Page" href="">'.
               '<img style="width:55px;height:55px" src="pix/moodlelogo55.png" alt="mylogoname" /></a></div>';

where My Home Page,, moodlelogo55.png, and mylogoname are examples, of course.

Upgrading Moodle

  • Copy the Moodle software directory as a backup:
sudo cp -r /usr/share/moodle /usr/share/moodle_bak
  • Copy the Moodle data directory as a backup:
sudo cp -r /var/lib/moodle /var/lib/moodle_bak
  • Copy the local Moodle configuration directory as a backup:
sudo cp -r /etc/moodle /etc/moodle_bak
  • Dump your MySQL database content:
mysqldump -u username -p -C -Q -e --create-options moodle > moodle-backup-2010-04-01.sql

where username is the database MySQL user account name used to create the Moodle database during Moodle installation. The corresponding Moodle database password will be requested. (If you have forgotten these, they are recorded in the /etc/moodle/config.php file as $CFG->$dbuser and $CFG->$dbpass).

  • Download and unzip the current Moodle package:
sudo wget
sudo unzip
sudo rm
  • Copy the new, extracted /moodle folder contents into the original /usr/share/moodle folder, overwriting the files there.
yes | sudo cp -r moodle/* /usr/share/moodle

Note: This method ensures that any files you have previously added, but for which no updates are available, remain in the /usr/share/moodle folder.

  • Make sure there is a symbolic link from your original config.php file in /etc/moodle to /usr/share/moodle. If not, create one:
sudo ln -s /etc/moodle/config.php /usr/share/moodle
  • There is a minor error in the version.php module numbering scheme from one version to the next. Edit the version.php file:
sudo nano /etc/moodle/version.php 
Change the line
$version = 2007101571.04;
$version = 2007101597.04;

Note: The new version number specified in $version must at least be greater than the $version number found in the version.php file located in the backup folder for the previous moodle installation (now presumably at /user/share/moodle_bak/version.php).

  • Login to your Moodle site (as an administrator) and load the new system:
Moodle -> Site Administration -> Notifications (Make sure to click on Notifications)

Moodle Site Building

Using BigBlueButton with Moodle

Using Skype with Moodle

Add Skype Block

Adding quotations to a block

Add a Quotation of the Day block

Personal tools