Gentoo Wiki


Wikipedia has an article on:

Moodle is a course management system (CMS) - a free, Open Source software package designed using sound pedagogical principles, to help educators create effective online learning communities. You can download and use it on any computer you have handy (including webhosts), yet it can scale from a single-teacher site to a 40,000-student University.

The word Moodle was originally an acronym for Modular Object-Oriented Dynamic Learning Environment, which is mostly useful to programmers and education theorists. It's also a verb that describes the process of lazily meandering through something, doing things as it occurs to you to do them, an enjoyable tinkering that often leads to insight and creativity. As such it applies both to the way Moodle was developed, and to the way a student or teacher might approach studying or teaching an online course. Anyone who uses Moodle is a Moodler.

The Moodle community

Moodle will run on any computer that can run PHP, and can support many types of database (particularly MySQL).




Install apache, mysql and dev-lang/php. For reference, see the LAMP index. I'll just state the essential changes in conf files from vanilla to moodle-configuration.

emerge apache mysql dev-lang/php -vp

Check your use flags. Use /etc/portage/package.use to enable ssl ldap jpeg mysql png tiff truetype xml2, where applicable. Then emerge.

Enable php and ssl for apache.

File: /etc/conf.d/apache2

Install the mysql database, start the service and set the root passwd.

# /usr/bin/mysql_install_db
# /etc/init.d/mysql start
# /usr/bin/mysqladmin -u root password <new-password>
# /usr/bin/mysqladmin -u root -h <your hostname> password <new-password>
Code: Start httpd
# /etc/init.d/apache2 start


Grab the unofficial ebuild from [1] and install it from your portage overlay. For instructions, see HOWTO Installing 3rd Party Ebuilds. Briefly - Create a directory for your e-builds. Add this to /etc/make.conf

# PORTDIR_OVERLAY="/usr/local/portage"

There are good instructions on [2]

First make the directories:

# mkdir -p /usr/local/portage/www-apps/moodle/files

Then grab these three files - the ebuild itself, reconfig, and GENTOO.readme.

# cd /usr/local/portage/www-apps/moodle/
# wget -O moodle-1.5.3.ebuild
# cd files
# wget -O reconfig
# wget -O README.gentoo
# cd ..
# ebuild /usr/local/portage/www-apps/moodle/moodle-1.5.3.ebuild digest

Then emerge

# echo 'www-apps/moodle ~x86' >> /etc/portage/package.keywords
# emerge moodle

This may take a little time, or even quite a long time, on older machines. On a Pentium 3/500 MHz with an old IDE drive, ext3 fs, the webapp-config linking process took an hour. While on a modern Pentium M/1700 MHz with an 5400 RPM IDE drive, ext3 fs, the whole installation process took about five minutes. Go get some coffee while waiting.

Note: please try upgrading to a recent (>=1.50.14) version of app-admin/webapp-config. This should speed things up dramatically.

After a successfull emerge moodle, you need to remove the existing config.php (because of a bug in the ebuild) and grant write access to the moodle directory, as well as the correct directory handling rights for Apache:

# cd /var/www/localhost/htdocs/moodle/
# rm config.php -f
# chmod a+w .
# cp lib/htaccess .htaccess

Create a new path away from the wwwroot. A suggestion:

# mkdir /var/moodledata
# chmod 777 /var/moodledata

Then create the moodle user and database. You can do this either manually from the mysql shell or via myphpadmin at a browser. First, the sheel method:

# mysql -u root -p
  > use mysql;
  > INSERT INTO user (host, user, password, select_priv, insert_priv, update_priv) VALUES ('localhost', 'moodleuser', PASSWORD('<yourpassword>'), 'Y', 'Y', 'Y');
  > SELECT host, user, password FROM user WHERE user = 'moodleuser'; # check your new user
          TO moodleuser@localhost IDENTIFIED BY '<yourpassword>';
  > quit
# mysqladmin -p reload
Warning: The sql code hasn't been verified.

You can use phpMyAdmin for creating the database. See phpMyAdmin for installation instructions. If you've installed phpMyAdmin, launch your favourite browser. If you didn't define the database manully, point your browser to and login as root, giving your root password for mysql. Create a user moodle, database moodle and grant all rights for the user for that database.

Now go to You may also do this from another computer, if you wish. Choose your language and press Next. The script will check your system and gives a report. If everything is ok, press next. The script will now ask for paths. Next, define the database as you did before. Next. Now you'll see the GPL licence, press yes if you understand and agree to it.

Now you'll hopefully see a pageful of sql, and several success messages. Good. :) Proceed. You'll see the release notes and get to the config.php page, followed by several other conf pages that are pretty straightforward. Create an admin account and try to remember the password.

Set up the cron job. This will run it once every hour.

File: crontab
0  *  * * *     /usr/bin/php /var/www/localhost/htdocs/moodle/admin/cron.php

Finally, glance over your config.php file. Fix the server address if it points to localhost. Try out if your server works from other computers.

Gongratulations! You've got a working Moodle server.


Site structure

Here is a quick summary of the contents of the Moodle folder.

config.phpcontains basic settings.
install.phpthe script you will run to create config.php
version.phpdefines the current version of Moodle code
index.phpthe front page of the site
admin/code to administrate the whole server
auth/plugin modules to authenticate users
blocks/plugin modules for the little side blocks on many pages
calendar/all the code for managing and displaying calendars
course/code to display and manage courses
doc/help documentation for Moodle
files/code to display and manage uploaded files
lang/texts in different languages, one directory per language
lib/libraries of core Moodle code
login/code to handle login and account creation
mod/all the main Moodle course modules are in here
pix/generic site graphics
theme/theme packs/skins to change the look of the site.
user/code to display and manage users


Activity modules are found at


ebuild from Gentoo wep-apps overlay


ebuild from Gentoo wep-apps overlay


Retrieved from ""

Last modified: Sat, 28 Jun 2008 06:18:00 +0000 Hits: 9,569