Moodle

From Univention Wiki

Jump to: navigation, search
Produktlogo UCS kurz.png Version 2.4
Produktlogo UCS school.png Version 2.4
Note: This article's procedure is not covered by Univention Support!

This article introduces you to the usage of Moodle. It covers the installation on a dedicated school server, as well as the users authentification with the LDAP. If further integration packages are needed, like loading classes from the LDAP or using the Microsoft Windows authentification for already logged in users, feel free to contact Univention for assistance.

Contents

Installation

This sectionn will cover the preparation and installation of Moodle on the system. Please make sure that every command is executed as root user.

Preparation

For the installation to succeed, some packages must be downloaded from the official Debian and Univention repositories. To activate the Univention unmaintained repository, execute the following command:

ucr set repository/online/unmaintained=yes

To add the Debian repository to the system, add the following line into the /etc/apt/sources.list file:

deb-src http://ftp.de.debian.org/debian lenny main

First, Moodle's dependencies must be installed:

univention-install php5-pgsql php5-curl php5-cli univention-postgresql php5-ldap

The PostgreSQL database modules must be included in PHP. Add the following two lines into the /etc/php5/apache2/php.ini file:

extension=pgsql.so
extension=gd.so

To use Moodle effectively, it is recommended to raise the memory usage limit to 40 MB. Also, it is recommended to raise the maximum size for uploads, e. g. 20 MB, to provide small programs to students. The changes must be done in the /etc/php5/apache2/php.ini file:

memory_limit = 40M
post_max_size = 20M
upload_max_filesize = 20M

For the changes to take effect, the Apache webserver must be restarted:

/etc/init.d/apache2 restart

Building Moodle and its dependencies

It is recommended to create a new directory for the build process:

mkdir ~/moodle
cd ~/moodle

First, some build option must be set:

export DEB_BUILD_OPTIONS='nocheck'

Next, the build dependencies of Moodle must be installed and source files must be downloaded:

apt-get build-dep moodle smarty wwwconfig-common yui
apt-get source moodle smarty wwwconfig-common yui

Now Moodle can be build. After the build process is finished, regular .deb files are created, that can be installed on other UCS server systems as well:

cd smarty-<version>
fakeroot dpkg-buildpackage
cd ..
dpkg -i smarty_<version>.deb
cd wwwconfig-common-<version>
fakeroot dpkg-buildpackage
cd ..
dpkg -i wwwconfig-common_<version>.deb
cd yui-<version> 
fakeroot dpkg-buildpackage
cd ..
dpkg -i yui_<version>.deb
cd moodle-<version>
fakeroot dpkg-buildpackage
cd ..
dpkg -i moodle_<version>.deb

During the installation, some questions must be answered. By default, the pre-selected option is sufficient.

Configuration

This section handles the basic configuration and LDAP connection for moodle and how to delete users in Moodle that are not in the LDAP anymore.

Basic configuration

First, Moodle's entry restrictions must be changed. To do so, edit the file /etc/moodle/apache.conf and edit the following line to match your network settings:

allow from 127.0.0.0/255.0.0.0

Also check the settings in the /etc/moodle/config.php file and change the entry localhost to the server's hostname:

$CFG->wwwroot

For the changes to take effect, the Apache webserver must be restarted:

/etc/init.d/apache2 restart

Now the Moodle service can be reached and configured by opening the web page in a webbrowser:

http://<server>/moodle

LDAP authentification

After the basic configuration is done, https should be activated in Security -> HTTP security. Next, the option Email-based self-registration should be deactivated and LDAP server should be activated.

Now the LDAP connection can be configured under Settings. The table gives information which default settings must be changed:

Key Value
LDAP server settings
Host URL <school server's FQDN>
Version 3
User lookup settings
Contexts cn=users,ou=<school>,dc=<domain>
Search subcontexts Yes
User Attribute uid
Course creator
Creators cn=lehrer,cn=users,ou=<school>,dc=<domain>
Cron synchronization script
Removed ext user Full delete internal
Data mapping
Update local On Every Login
Update external Never
Lock value Locked

Hint: To obtain the LDAP basis, execute the following command on the school server:

ucs get ldap/base

Hint: To obtain the system's FQDN, execute the following command on the relevant system:

hostname -f

LDAP mapping

Furthermore, the following mapping applies for LDAP entries:

Key Value
First name gn
Surname sn
Email address mail
Phone 1 telephoneNumber
Phone 2 homePhone
City/town l
Country c

Cronjob for deleting users

In order for Moodle to remove users from its databse that are deleted in the LDAP, a cronjob must be defined in the UDM.

UCR name Value
cron/moodle/time */10 * * * *
cron/moodle/command wget -q -O /dev/null http://localhost/admin/cron.php

Restrictions

  1. OU: At this time it is not possible for Moodle to search for all users using the LDAP base DN.
  2. Class mapping: This article does not handle mappings between UCS@School classes and Moodle groups. If you need assistance to create the respective mapping or would like to have the setup packaged, feel free to contact Univention for an offer to create either.
Personal tools