HOWTO: Moodle on Gentoo

14 April 2006

Introduction

Moodle is an e-learning platform that can be used for schools, universities, colleges and so on. I personally am primarily interested in higher education.

According to Zacker.org, Moodle has now become the most used e-learning platform in higher education, with more installs than Blackboard and WebCT put together (for a quick idea see this market penetration chart).

Not only does it (arguably) have the most features and the best stability record, it is also free/open-source, meaning that it is free as in beer as well as free as in speech.

After talking to a colleague who was helping out someone who is providing a moodle server for a school, I thought I had better check it out.

Moodle was a doodle to install, it took me about half an hour to install onto my little LAMP server (including typing out what I was doing). Of course if you were doing this seriously, you would need to spend a little extra time on the theme to match your existing website.

Here is some notes that I made while installing it, I hope it they will be helpful. As always, comments and corrections are always welcome.

Browse through the whole guide before you begin. It would be worth consulting Gentoo Wiki HOWTO Moodle and the Installing Moodle guide at Moodle.org. You should refer to those alongside this guide, especially if you are reading this guide a long time after 2006.

Step 0. You need a working LAMP setup

Here is how to do it the Gentoo may:

  1. You need a working Gentoo install - See the Gentoo Handbook for how to do that. It will take between an evening and a week, depending on how used to Linux you are.
  2. Install Apache with PHP - emerge apache mod_php should get you started.
  3. Install MySQL, this is more difficult, best to follow the Gentoo MySQL howto (emerge phpmyadmin be prove very helpful too)

Step 1. Setup the portage overlay

If you are reading this some months later and the Gentoo ebuild has been through the internal Gentoo quality assurance already, you will be able to skip steps 1 and 2.

At time of writing, the Moodle ebuild is not 100% official, so you need to add it yourself. A nice way of doing this to separate the official builds that you automatically download using emerge --sync from those that you have added yourself, a directory of your own ebuilds is called "a portage overlay".

Add this to /etc/make.conf

PORTDIR_OVERLAY="/usr/local/portage"

Not done yet, lets continue.

Step 2. Setup The ebuild for Moodle

a. Make the directories:

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

b. You need to grab all the files, well at least you need the main three files, run all the following commands:

 cd /usr/local/portage/www-apps/moodle/
 wget http://svn.gnqs.org/projects/gentoo-webapps-overlay/browser/experimental/www-apps/moodle/moodle-1.5.3.ebuild?format=raw -O moodle-1.5.3.ebuild
 cd files
wget http://svn.gnqs.org/projects/gentoo-webapps-overlay/browser/experimental/www-apps/moodle/files/reconfig?format=raw -O reconfig
 wget http://svn.gnqs.org/projects/gentoo-webapps-overlay/browser/experimental/www-apps/moodle/files/README.gentoo?format=raw -O README.gentoo
 cd ..
 ebuild /usr/local/portage/www-apps/moodle/moodle-1.5.3.ebuild digest

Step 3. Emerge moodle

Moodle currently has three use flags. Firstly there are flags to define what database you want, i.e. mysql or postgres. The other flag is the vhosts flag; this is to define whether you want moodle to be automatically installed in the default location within the Apache directory (htdocs/moodle) or you want to choose your own location.

I chose to use MySQL and the default location, so my use flags for moodle look like this:

USE="mysql -postgres -vhosts" emerge moodle

If you want to use a postgres database and you want to choose the location then choose:

USE="-mysql postgres vhosts" emerge moodle

Step 4. Run a few more random commands.

These are from the `Gentoo Wiki Guide`_, these basically finish the install by sorting out the permissions and getting rid of the stock config.php (we will make our own later).

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

System Message: WARNING/2 (<string>, line 74); backlink

Inline literal start-string without end-string.

Obviously if you changed the default location for moodle then you need to adapt the first line accordingly.

Step 5. Create some data directories.

If you have your own server then you can make the whole thing much more secure by moving the data directories out of your Apache directory.

``mkdir /var/moodledata

System Message: WARNING/2 (<string>, line 90); backlink

Inline literal start-string without end-string.

chmod 777 /var/moodledata

mkdir /var/moodlequarantine

chmod 777 /var/moodlequarantine

``

System Message: WARNING/2 (<string>, line 98); backlink

Inline literal start-string without end-string.

Step 6. Create the moodle database and user

You can do this using the MySQL shell or through phpmyadmin. I will quote from the `Gentoo Wiki Guide`_ and from the Moodle Install guide. Change to something else.

Using the MySQL shell:

> ``# mysql -u root -p > > > use mysql; > > > INSERT INTO user (host, user, password, select_priv, insert_priv, update_priv) VALUES ('localhost', 'moodleuser', PASSWORD(''), 'Y', 'Y', 'Y'); > > > FLUSH PRIVILEGES; > > > SELECT host, user, password FROM user WHERE user = 'moodle'; # check your new user > > > CREATE DATABASE moodle; > > > GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER ON moodle.* > > TO moodleuser@localhost IDENTIFIED BY ''; > > > quit > > # mysqladmin -p reload > > ``

System Message: WARNING/2 (<string>, line 106); backlink

Inline literal start-string without end-string.

Using phpmyadmin:

> If you didn't define the database manully, point your browser to http://127.0.0.1/phpmyadmin/ 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.

Using Postres:

> # su - postgres > > > psql -c "create user moodleuser createdb;" template1 > > > psql -c "create database moodle with encoding 'unicode';" -U moodleuser template1 > > > psql -c "alter user moodleuser nocreatedb;" template1 > > > psql -c "alter user moodleuser with password 'yourpassword';" template1 > > > su - root > > # /etc/init.d/postgresql reload

Step 7. Run the install script

Now open a web broswer and go to wherever you have installed moodle, for example:

http://www.domainname.com/moodle/install.php

http://www.domainname.com/install.php

http://127.0.0.1/moodle/install.php

This will open the install wizard. It will create a moodle config file for you. You bascially click next a lot. Below I have provided a small note on each section where I have thought of something useful to say.

a. Choose your language.

I chose en for English.

b. It then checks your PHP settings.

c. Choose the directory settings:

I put the data in /var/moodledata see step 5 above.

d. Fill in the database settings,

You need to enter the username and password that you made earlier, e.g. moodleuser and .

e. config.php has been successfully created.

This is not the end, this is not the beginning of the end, this is the end of the beginning.

f. You are then shown the GPL.

Make a cup of tea, lie back and get reading...

g. It then sets up the tables in database, outputting all the queries to the screen.

Don't panic! These are not error messages, these are SQL queries, look down to the bottom, mine said "Database was successfully upgraded".

h. It then tells you the version number.

Okay...

i. It then gives you all the release notes.

More exciting reading for you...

j. You are then shown a Variables configuration screen.

  • You can change these later, so don't get too worried about getting everything right the first time.
  • A rather nice feature is that you can set moodle to use ClamAV to scan the files that your students/users upload.
  • Your path to clam AV is probably /usr/bin/clamscan
  • I set my quarantine directory to /var/moodlequarantine see step 5 above
  • For my zip programs I added /bin/gzip and /bin/gunzip .
  • Path to du was /usr/bin/du or /bin/du (/usr/bin/du is a symlink to /bin/du)

**k. Then it sets up the module tables, **

System Message: WARNING/2 (<string>, line 215); backlink

Inline strong start-string without end-string.

More pretty SQL here, keep clicking next if everything is green.

l. Eventually you get to the site settings.

Here you provide the text that will show on the front page and so on. You can change this later, so probably best to keep it simple for now.

m. Account profile

Lastly you setup a profile for the admin user, make sure that you remember the password. Then your are done!

Docutils System Messages

System Message: ERROR/3 (<string>, line 72); backlink

Unknown target name: "gentoo wiki guide".

System Message: ERROR/3 (<string>, line 102); backlink

Unknown target name: "gentoo wiki guide".

1 Zeth says...

Moodle has gone to 1.6 and the overlay above has not been upgraded yet. So your choices at this point:

  1. Use Moodle's normal instructions.
  2. Install Moodle using above and then do an automatic upgrade.
  3. Wait for the ebuild to be upgraded (or rewrite it yourself)!

Posted at 6:03 p.m. on July 4, 2006


What do you have to say?

Show Editing Help

About

Hello, my name is Zeth, I'll be your host here.

Command Line Warriors is about taking control of your own technology, it looks at our experiences of computing; especially using GNU/Linux, the Python programming language, the command-line and issues such as techno-ethics, best practices and whatever is cool now. If you take control of your technology then you are a Warrior too!

This site is your site too which means that you can contribute and get involved. You can leave comments using the facility provided. For me, the comments and discussions are by far the best part of the site. So please do have your say!

Latest Discussions

Zeth

November 29, 2009
Hi Jordan, yes that URL is gone now. I have a new contact form on this site.
Python CGI contact forms

Jordan

November 29, 2009
Zeth attention! Your form, http://zeth.me.uk/contact/, is not working The explorer says connecting ..but nothing happens Sorry for my poor English: I am Spanish Regards
Python CGI contact forms

Jordan

November 26, 2009
Sorry: tell me , not tellme (I'm spaniard) And http://zeth.me.uk/contact/ don't work
You got the touch, you got the power

David Jones

November 25, 2009
Your mad skillz are too l33t! for me. I specifically switched to Google Reader so that I could show people what blogs I read. But I couldn't work out how ...
How to find the fashionable blogs quickly

Brian R. Hickey

November 20, 2009
Symantec picked it up too.
How to bring down Internet Explorer with six words

Zeth

November 17, 2009
Thanks djm, I am the moose here. Christian, assuming one actually does Internationalise the countries, it should still work I guess, as the gettext stuff will happen before the list ...
Countries in Django

Phillip Temple

November 17, 2009
Good start, but: a) wouldn't I want None back rather than 'ZZ'? b) why not add a 'shortcut' boolean, then prepend flagged fields (plus usual '-----' separator) to the actual ...
Countries in Django

djm

November 17, 2009
Am I being a moose or did you mean: from whatever.countries import CountryField instead of from whatever.countries import CharField ? Good post though, cheers.
Countries in Django

Christian Joergensen

November 17, 2009
Wouldn't the ordering get messed up after i18n?
Countries in Django

Steve - Electronic Cigarettes Fan

November 17, 2009
Very well done. Is your blog just you writing? Nicely done, Steven.
Blogger vs Wordpress

vetetix

November 15, 2009
Sorry to bother you nearly two years after you wrote this blog article, but I can't manage to find how to modify an existing field. I am trying to change ...
Three Useful Python Bindings - ClamAV, Apt and Evolution

Manju

November 4, 2009
I am transferring some files using psftp to other device's FAT partition. But the filestamp of the file being transferred is modified to that of FAT device, after the transfer. ...
PuTTY Series: Using PSFTP

iki

November 2, 2009
or simpler: socket.gethostbyname_ex(socket.gethostname())[2]
How to find out your IP address in Python

iki

November 2, 2009
local_ip = set([ i[4][0] for i in socket.getaddrinfo(socket.gethostname(), None) if i[0] == 2 ])
How to find out your IP address in Python

Fred

November 2, 2009
testing rst ------------- - point 1
An Introduction to ReStructuredText

Ano

October 27, 2009
"You simply found the license of the StumbleUpon Toolbar for Internet Explorer." That's possible. I've got some more interesting information to add. Firstly, go to this page: https://addons.mozilla.org/en-US/firefox/addon/138 - this ...
Are your Firefox extensions proprietary software?

Ken

October 21, 2009
Stumbled in here at lunch. This is the best find of the week. Thanks.
Three classic command line tips

Jim

October 19, 2009
Thanks for the rtsp:// post - that's something that has been bugging me for a while!
Three classic command line tips

Zeth

October 18, 2009
Thanks for the comments guys. Great to see the all the gang are still here!
Three classic command line tips

Bubba

October 18, 2009
Is there any way psftp can return the true transfer rates oberved during the actual transfer?
PuTTY Series: Using PSFTP