E-Learning with Moodle

Helping Hand

© Vladimir Voronin, 123RF

© Vladimir Voronin, 123RF

Article from Issue 109/2009

The Moodle course management system is useful for e-learning and for practical work in the computer room.

E-learning comes in all shapes and sizes: Besides online-only approaches that attempt to disseminate all of the content in a training or study program via the Internet, hybrid approaches that include standard classroom teaching are also available. Such hybrid approaches are often referred to as "blended learning." However, software that supports e-learning needs to do more than just offer a collection of data and user management features for a course.

Moodle [1] is a course management system (CMS, or Learning Management System, LMS) that was originally developed by computer scientist and educator Martin Dougiamas on the bases of various didactic considerations.

Rather than focusing on file management, the software concentrates on course design and gives trainers, teachers, and lecturers numerous options for adding interactive elements to their courses, including group (home) work and tests.

Some of Moodle's really useful features are elements, such as glossaries or wikis, that trainers can link to with tasks for their students. One task could be to create five new glossary entries, for example. This means that the students add to the knowledge base stored on the learning system. After being checked by the trainer, the new entries could be added to the general knowledge pool, which is available to all participants and can be reused in later courses.

Moodle Installation

Moodle requires a working web server – typically Apache 2.x on most systems – and you need to create a new domain in the Apache configuration or modify the settings of an existing domain by adding a /moodle subdirectory.

Many Moodle installations contain normal web content besides the LMS; in this case, it makes sense to use a subdirectory. If you do not have any additional content for the domain, you can create an Apache rewrite rule to jump directly from the root directory to the /moodle directory.

Listing 1 shows a sample Apache configuration for a fictive new domain named moodletest.local. Incidentally, the rewrite engine will not work on openSUSE unless you add the rewrite module to the APACHE_MODULES variable in /etc/sysconfig/apache2.

Listing 1

Sample Configuration

# moodletest.local.conf
<VirtualHost *>
  ServerName moodletest.local
  ServerAlias www.moodletest.local
  DocumentRoot /var/www/moodletest.local
  # you only need the next two lines if you have no
  # content apart from the Moodle system
  RewriteEngine On
  RewriteRule ^/$  /moodle/ [R]
  ErrorLog  /var/log/apache2/moodletest.local/error.log
  CustomLog /var/log/apache2/moodletest.local/access.log Combined

The virtual host file should be located in /etc/apache2/sites-available for Debian systems, and you will need to link from /etc/apache2/sites-enabled. OpenSUSE users can simply copy the file to the /etc/apache2/vhosts.d/ folder and add a .conf file suffix to let the server find it. If you are testing the installation on your home computer, you will need an entry in /etc/hosts like moodletest.local

to be able to use this hostname in the web browser later. To create a directory for the Apache logfiles, enter mkdir -p /var/log/apache2/moodletest.local at the command line.

Debian users run apt-get to install the php4-gd, libgd-gd2-perl, mysql-server- 5.0, php4-mysql, and php4-curl packages and then configure the MySQL server:

# dpkg-reconfigure mysql-server-5.0

On openSUSE 11.1, you must set up the required software by running zypper to install the php5, php5-gd, mysql, apache2-mod_php5, php5-mysql, php5-curl, php5-mbstring, php5-openssl, php5-xmlrpc, and php5-zlib packages. When you've finished that step, enable the MySQL server by entering the following command:

# rcmysql start; mysqladmin -u root password password

The server should be running now, and you have already assigned a root password.

MySQL Database for Moodle

Next, create a MySQL database named moodle and grant access to a moodle user account with the password moo!dle. In Listing 2 you will see the commands needed to do this. Then you can reparse the configurations for Apache and MySQL by entering /etc/init.d/apache2 reload and /etc/init.d/mysql reload.

Listing 2

Creating a MySQL Database

# mysql -u root -p
mysql> create database moodle;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on *.* to 'moodle'@'localhost' identified by 'moo!dle';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit

The commands in Listing 3 install Moodle in the subdirectory /var/www/moodletest.local/. If you prefer to use a different folder, you can modify the path here and in the following steps.

Listing 3

Installing Moodle in a Subdirectory

$ export WEBROOT=       /var/www/moodletest.local
$ mkdir -p $WEBROOT; cd $WEBROOT
$ wget http://download.moodle.org/      stable19/Umoodle-weekly-19.tgz
$ tar xzf moodle-weekly-19.tgz

Moodle needs a data directory that defaults to /var/www/moodledata. The user account on which Apache is running needs read and write access for this directory. To identify the user ID under which the web server is running, check the process list for apache or httpd (Listing 4, lines 1 through 3). The first Apache process always runs as root, so ignore it. In the example here, which uses a Debian system, the correct user account is www-data; other distributions run Apache as wwwrun. Now you can set up the moodledata directory (Listing 4, lines 4 through 6).

Listing 4

Setting Up the moodledata Directory


Moodle Setup

To start the web-based configuration, open the http://moodletest.local/moodle page in your web browser. If needed, you can select a language on the first page of the dialog. Continue takes you to the second page, where Moodle checks the PHP configuration and displays the results. For all of these topics, you should see Success in green type. Continue through the following dialogs by pressing Continue.

The next step is to define where you want Moodle to store its data (Figure 1). If you are following the recommendations from this example, the default (/var/www/moodledata) will do just fine. If you are running independent Moodle installations parallel to one another, you need to change this. The web address, http://moodletest.local/moodle in this example should be okay, too – after all, you have to enter the right address to call the configuration interface.

Figure 1: Checking the paths and web address at the start of the Moodle setup.

Moodle will prompt for the login credentials for the MySQL database (Figure 2). Here, I created a database user moodle with the password moo!dle; you can accept the default server name, localhost. If you are using a remote MySQL server instead of the local server used in this example, you will need to enter the correct server name here.

Figure 2: For the setup, you need the moodle MySQL user's login credentials.

Next, accept the default database name moodle and the table prefix mdl_. A prefix on all of your table names makes it easier to use the tables of multiple Moodle versions (and any other applications you might be using) on a single database. Of course, this only makes sense if you do not have sufficient privileges to create another MySQL database.

The next dialog displays the results of various checks: You should see OK in the Status column on the right. The next page is for information purposes only. The installer creates a config.php file in the root directory of your Moodle installation; this is /var/www/moodletest.local/moodle/ here. Caution: The database password is in cleartext.

Now accept the terms of the GPL license for Moodle; again, you can let the installer handle all of the steps that follow automatically. To do so, check Automatic setup. This removes the need to keep clicking to get to the next page. The following steps can take some time, and the status messages could fill the screen multiple times.

Finally, you will end up on the Setup administrator account page where you can set up a Moodle account for the administrator of the new system (Figure 3). The important things here are the login name and password – Moodle will suggest a username of admin. Also, you need to fill in some of the other fields, although you can leave the optional entries for later.

Figure 3: Creating an account for the Moodle administrator.

The installation continues with information about the new Moodle page (Figure 4). Here, you can enter long and short page identifiers and, if needed, add a short piece of text for the start page.

Figure 4: The name of the page and a short description are useful for the users of the new Moodle page.

Switching the Self-registration from Disable to Email-based self-registration allows users of your Moodle page to register with the system. This assumes that your computer has Sendmail, Postfix, or some other mail daemon and can dispatch mail; as an alternative, you can set up access to a remote SMTP server for dispatching mail. At the end of the page, you can accept the changes by clicking Save Changes. This action completes the setup and takes you to the start page – as the administrator (Figure 5).

Figure 5: The administrator's view of the Moodle start page – no courses are available thus far.

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More