Install and configure moodle in CentOS 6.3 with video streaming and recording

Moodle is a E-learning platform free as in free beer. Moodle is a CMS (Course Management System) and also known as a LMS (Learning Management System) or a VLE (Virtual Learning Environment).

I was in need to install a configure a system like this and I’ve chosen Moodle not also because is one of the best out there, but because is also free.

One of the key features that i was also needing was a video streaming and recording facility.  Moodle has it all (through plugins).

What I’m going to describe here is an installation of Moodle from the very beginning:

I’ve installed a CentOS 6.3 minimal – I’m going from here.

Necessary a MySQL database (although Moodle supports others),  HTTP server (I’m going with Apache) and PHP.

Edited:  As gshaw0 pointed out, there is no need to add additional repositories if you only want to install Moodle without the video streaming features ! Thank you gshaw0 !


PHP has some requirements about extensions and we need to configure other repositories, such as rpmforge and EPEL.


To install rpmforge, just get the package for your distribution and architecture.

Note: If you don’t have wget (or it’s a headless server) you must install it.

yum install wget

Get the package (replace with the correct package)


Install it

rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm

After install, go to /etc/yum.repos.d/ and edit rpmforge.repo and enable the rpmforge-extras repository, replacing 0 (zero) with 1 in the enabled = 0 line


Get the correct package for your CentOS version (i’m using 6.3)

rpm -ivh epel-release-6-7.noarch.rpm

Now, we can install the php extensions required by moodle

There aren’t all the extensions available for PHP as rpm you can install with yum, but pecl and pear are of help.

Install those we can install with yum

yum install php

Note: According to moodle docs,  iconv, ctype and tokenizer are now included in PHP by default.

Some extensions are already built-in in PHP. To find out which just execute:

php -i | grep -i <extension_name>

Example for curl:

php -i | grep -i curl

The result, among other things, should be:

 cURL support => enabled
 cURL Information => 7.19.7

According to my php, the following extensions are built-in:

iconv, ctype, tokenizer, curl, openssl, ldap, zip, gd, simplexml, spl, pcre, json

Install the rest of the php extensions

yum install php-mbstring php-xmlrpc php-soap php-gd php-domxml-php4-php5 php-xml php-intl php-mysql


Install the MySQL server

yum install mysql mysql-server

Start the server and follow the on screen instructions for the initial installation and configuration

/etc/init.d/mysqld start

Create the database

Note: Change database name, user and password according to your preferences

create database <database> default character set utf8 collate utf8_unicode_ci;
 Query OK, 1 row affected (0.00 sec)
mysql> grant select,insert,update,delete,create,create temporary tables,drop,index,alter on <database>.* to <user>@localhost identified by '<password>';
 Query OK, 0 rows affected (0.00 sec)

Save the values for later use.


Download Moodle from it’s server


decompress the file

tar -zxvf moodle-latest-23.tgz

Now you get a Moodle directory. If this is going to be a dedicated server for Moodle, I suggest you copy the contents of the Moodle directory to your server document root. This way, you can access the server by

If it is a shared server, copy the Moodle directory to your server document root directory and configure it accordingly.


This is were all the uploaded files, session files, temporary files are going to be stored. Moodle documentation suggests permissions as 0777 (write, read, execute for everyone) – I don’t thing this is necessary. Only the web server user/group should be able to write here.

Let’s assume /var/www

mkdir /var/www/moodledata

As suggested by Moodle documentation:

chmod 0777 /var/www/moodledata

My suggestion:

chm0d 0774 /var/www/moodledata
chown apache:apache -R /var/www/moodledata

If this is going to be a shared server, view the Moodle installation docs for more information.

Install Moodle

Let’s install it.

Moodle documentation suggests to use the CLI (Command Line Interface) to run the setup.

Let’s change the owner of the files for the installation

chown -R <apache_user> /var/www/html
cd /var/www/html/admin/cli

Execute the installer:

/usr/bin/php install.php

Answer the several questions the installer asks you

and in the end, you should see:

++ Success ++
 ++ Success ++
 ++ Success ++
 ++ Success ++
 ++ Success ++
 ++ Success ++
 ++ Success ++
 ++ Success ++
 ++ Success ++
 ++ Success ++
 ++ Success ++
 ++ Success ++
 Installation completed successfully.

Revert the owner of the files:

chown -R root /var/www/html

Note: I believe the files should be owned by the apache user - but this is just a personal opinion
Now you have Moodle installed.

Try to access it:


PS: If you can’t access it, see if you have iptables running.


Moodle uses a php file that must be run in background in  regular intervals to perform several tasks. Read here for more information.

NOTE: The Moodle server will not run well if this process is not done.

yum install cronie

After the installation of cron, check what user is running the apache web server (IT SHOULD NOT BE ROOT).

grep -i user /etc/httpd/conf/httpd.conf

The result should be something like this:

# User/Group: The name (or #number) of the user/group to run httpd as.
 #  . On SCO (ODT 3) use "User nouser" and "Group nogroup".
 User apache
 # UserDir: The name of the directory that is appended onto a user's home
 # UserDir is disabled by default since it can confirm the presence
 UserDir disabled
 # directory, remove the "UserDir disabled" line above, and uncomment
 #UserDir public_html
 # Control access to UserDir directories.  The following is an example
 LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
 LogFormat "%{User-agent}i" agent
 #LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" %I %O" combinedio

The bold line is the result we want.

Now, add the cron job with that user:

crontab -u apache -e

and add the line

# Run the cron every 15 minutes
 */15 * * * * /usr/bin/php  /var/www/html/admin/cli/cron.php >/dev/null

Save and quit


Moodle seriously recommends that a PHP accelerator should be installed.  There are many, but i’m going to install APC.

yum install php-pecl-apc
service httpd restart

And APC accelerator should be active.

For more information about performance, check the “Performance Recommendations“.

Video Streaming and Recording within Moodle

Note: I’ll be using the same server. OpenMeetings has some requirements about the server. Check them in the installation page.

For more available packages for Video Streaming, check the post “Free and Open Source Web Conferencing (Online Meetings, Webinars) Tools for e-Learning” from eFront.

One of the features i’m searching for Moodle to be able to perform is Video Streaming and Recording. This feature is a must have.  After searching and reading, I’ve choose OpenMeetings. It is simple to install and simple to use.

It has a Moodle  plugin and the configuration is straightforward, but we must install the server before.


Install Server

Go to downloads page and download OpenMeetings Server

Before, unpacking it, necessary to install some requirement packages

OpenMeetings requires ORACLE JRE 6

Installing Java

Go to and download the Linux RPM

After download, as root:

rpm -ivh jre-7u9-linux-i586.rpm

After install, check the version

/usr/bin/java -version

It should be something like:

/usr/bin/java -version
 java version "1.7.0_09"
 Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
 Java HotSpot(TM) Client VM (build 23.5-b02, mixed mode, sharing)

If something else (check the version YOU have installed), probably you should use alternatives to change it. Check the site If Not True Then False to see how to use alternatives to change the Java version.

Since i didn’t had any java (openjdk or java-gcj), i didn’t need to use alternatives.


To use some features (image upload and import to whiteboard), ImageMagick is necessary.

yum install ImageMagick (respect the upper case letters)

Importing PDFs

To be able to import PDFs to whiteboard, there are two packages that need to be installed.

Ghostscript is easy as: (probably is already installed):

yum install ghostscript

SWFTools is also installable with yum

yum install swftools

Make sure swftools version is 0.9 or above as previous versions have a bug (according to OpenMeetings website).

Recording and importing avi, flv, mov and mp4 into whiteboard

Necessary to install ffmpeg and sox

But, according to the website, ffmpeg must have the libmp3lame option enabled –libmp3lame.

You now have two choices:

Get the source rpm, install it, change the SPEC file to have the option –libmp3lame and rebuild the package


Get the ffmpeg source package and compile it yourself.

I’m going with the source package

Rebuilding ffmpeg

NOTE: There’s a general rule not to rebuild packages as the ROOT user. You can read about it here. I’m just doing it as root because this is a Virtual Machine I’m using to test the installation, but you should read about it.

Get the ffmpeg source rpm from here.

should be (as of the writing of this): ffmpeg-0.6.5-1.rf.src.rpm

After download, install it:

rpm -ivh ffmpeg-0.6.5-1.rf.src.rpm

Install the necessay packages

yum install rpm-build gcc make

You should now have a directory called rpmbuild. Inside there is a directory called SPECS. Inside there should be a file called ffmpeg.specs.  This file contains the configuration used to compile ffmpeg.

Edit the file and locate the %build macro. After the macro, should see something like this:







These are the configuration options that the package will be configured and later compiled with.

Locate the line


and change it to


Save and quit

Install required packages:

yum install SDL-devel imlib2-devel freetype-devel zlib-devel a52dec-devel libdc1394-devel dirac-devel faac-devel faad2-devel gsm-devel lame-devel opencore-amr-devel librtmp-devel schroedinger-devel texi2html libogg-devel libtheora-devel libvdpau-devel x264-devel speex-devel

And now rebuild ffmpeg

rpmbuild -bb ffmpeg.spec (-bb means build binary).

More information about rebuilding rpms can be found here and here .

NOTE: If you get an error about libdirac (although dirac-devel is installed), install libstdc++-devel

And you can now see, ffmpeg will be compiled with the option we wanted:

./configure --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth '--extra-cflags=-O2 -g -march=i386 -mtune=i686' --enable-avfilter --enable-avfilter-lavf --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab

Go and have some beer. This can take a while.

If everything goes well, you can now install ffmpeg. The RPM will be located inside the rpmbuild directory, in RPMS/<arch>.

rpm -ivh * (you should have more than one ffmpeg-* rpm).

And finally, install sox.

yum install sox

Enabling import of .doc, .docx, .ppt, .pptx,…

EDIT: As bait pointed out, OpenOffice is still needed for docs/ppts/etc… files to be used with OpenMeetings . You can get more information here.  I’ll edit the post later and add the headless instalation. Thank you bait !

For this to work, we need JODconverter and OpenOffice converter. Fortunately, earlier versions required OpenOffice to be installed. No more this is necessary since version 2.x .

Note: OpenOffice Converter is no longer necessary.

To get JODConverter, go the its page, at Google code.

Unzip it and put it where you want. I’m going to move it to /opt

mv jodconverter-core-3.0-beta-4 /opt

NOTE: Later is necessary to configure OpenMeetings with the path

OpenMeetings by default works with apache derby database, but it can be configured to use MySQL. I’m going with MySQL.

At this point, we already have everything we need to install and configure OpenMeetings.

Create a directory and move the OpenMeetings file you’ve download (at this time, apache-openmeetings-incubating-2.0.0.r1361497-14-07-2012_1108.tar.gz)

mkdir openmeetings
mv apache-openmeetings-incubating-2.0.0.r1361497-14-07-2012_1108.tar.gz openmeetings
cd openmeetings
tar -zxvf apache-openmeetings-incubating-2.0.0.r1361497-14-07-2012_1108.tar.gz

It will now uncompress and create a series of files and directories.

Move the directory to another place. I’ll use /opt

mv openmeetings /opt

Before proceeding with running it, let’s configure it to use MySQL, if you want. If not, just proceed to “Running and Configuration”

Download the MySQL connector from here

Uncompress it and copy the file mysql-connector-java-5.1.22-bin.jar (your version can be other) to /opt/openmeetings/webapps/openmeetings/WEB-INF/lib/

Let’s proceed with the configuration. This is available at the OpenMeetings website.

cd /opt/openmeetings/webapps/openmeetings/WEB-INF/classes/META-INF

First, create a backup of the persistence.xml file

cp persistence.xml persistence.xml.bak
cp mysql_persistence.xml persistence.xml

Edit the file persistence.xml and search for the lines: (almost at the end of the file)


, Username=root

, Password=”/>

and fill in your database detais.

NOTE: Make sure your MySQL database is using UTF-8 as the server charset.

You can change this, editing /etc/my.cnf and adding the line in the [mysqld] section:


Save and restart mysql

/etc/init.d/mysqld restart


service mysqld restart

Running and Configuration

Now, start the

cd /opt/openmeetings

and go to


After fill in your values, and login in, you’re done with the server.


Moodle Plugin

Just browse to and download the plugin

copy it to your moodle server to <moodle_install_dir>/mod directory

uncompress it


and change the permissions

chown <apache_user>:<apache_group> -R openmeetings

Go to Moodle and login (as administrator)

The plugin installation page should appear to complete the installation.

And now you should have a working Moodle with Video Streaming and Recording

Hope this tutorial be of your help.

Authentication using LDAP (work in progress)

Preparing the system

Note: For this to work, you need to have a working LDAP server (Openlda).  I’m not covering here how it’s done. There’s plenty of tutorials online on how to do it. But before, if you don’t know what LDAP is, I recommend read about it and what is it for.

LDAP authentication is a bit tricky, especially if you’re using SSL in your server.

Here are some tricks, from Moodle documentation about LDAP – It worked for me, to enable SSL.

If you’re not using SSL, then proceed to Configuring Moodle with LDAP (below)

Copy your certificate files to the Moodle server, to the /etc/pki/tls/certs directory. Once there, just issue the cacertdir_rehash command.

cacertdir_rehash `pwd`

and the certificate file(s) now have links to them.

Now, it’s necessary to configure the openldap. Open the file /etc/openldap/ldap.conf

vi /etc/openldap/ldap.conf

Search the line:

TLS_CACERTDIR  /etc/openldap/certs

and change it to

TLS_CACERTDIR /etc/ssl/certs


TLS_CACERTDIR /etc/pki/tls/certs

It doesn’t matter, because in /etc/ssl, certs is a symlink to /etc/pki/tls/certs

Save the file and exit

Probably you’re going to need to restart the apache server (or other if you’re not using Apache).

service httpd restart <change httpd according to what server you're using>

Now, check the connection to your ldap server

openssl s_client -connect <IP or DNS of LDAP server>:636

If you get something like this:

depth=0 C = PT, ST = my city, L = my city, O = my company, OU = Department, CN =, emailAddress =
verify return:1
Certificate chain
 0 s:/C=PT/ST=my city/L=my city/O=my company/OU=Department/
   i:/C=PT/ST=my city/L=my city/O=my company/OU=Department/
Server certificate

Then it’s working.

Configuring Moodle with LDAP

Now, go to your Moodle instalation, and to the administration options

First, necessary to enable the LDAP plugin:

Go to SETTINGS -> Site Administration -> Plugins -> Authentication -> Manage Authentication and enable LDAP Server, by pressing the “Closed Eye” in the Enable Column.

After that, press settings and configure according to your configuration (and needs):

I have an Openldap server, so i’m using the configurations for it here. I’m only putting the values I’ve changed. All the others are the default values used by Moodle



if using SSL

ldaps://<IP or DNS LDAP SERVER>:636

if not

ldap://<IP or DNS LDAP SERVER>

Version 3 (default)

LDAP encoding: utf-8

Bind Settings

Hide passwords: YES (prevents from being stored in Moodle)

Distinguished name: cn=Manager,dc=domain,dc=com (The user you use to access your LDAP for search users)

Password: <the password>

User Lookup Settings

User type: posixAccount (rfc2307) – For Openldap

Contexts: ou=people,dc=domain,dc=com (the context where your users are in)

Search subcontexts: No

Deference aliases: No

User attribute: uid (The user attribute used in the LDAP for searching for users)

Member attribute: memberuid (The same, but for groups membership)

Force change password

Force change password: No (passwords are not in Moodle)

Use standard page for changing password: No

password format: MD5 hash (this is mine. Yours can be different)

LDAP Expiration settings

Expiration: LDAP (LDAP has all the passwords)

Grace logins: No