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:

a. 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.

  1. Install Apache with PHP - emerge apache mod_php should get you started.

c. 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. *

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

Inline emphasis start-string without end-string.

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 offical 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"

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: *

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

Inline emphasis start-string without end-string.

``

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

Inline literal start-string without end-string.

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

``

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

Inline literal start-string without end-string.

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. **

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

Inline strong start-string without end-string.

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 114); 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 132); 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 140); 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 150); 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 269); 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 110); backlink

Unknown target name: "gentoo wiki guide".

System Message: ERROR/3 (<string>, line 144); 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

Europython

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

picsus

January 5, 2009
Monique, a Leaf fan, originate this plumb persistent to believe. Now, let me regarding out that this was in no way an try to articulate one cooperate is more wisely ...
This week in the world of the Command Line; The Friday Round up!

QuickSilver

January 5, 2009
Nice! Is there anyway to implement a ServerAliveInterval for long processes? This is because my our firewall keeps closing the connection based on inactive connections. Thanks,
SFTP in Python: Really Simple SSH

Tun

January 5, 2009
Hi, Do You know, haw can i get start date for tasks evolution? If exists the similar way to your example: i.get_due() ? I would like to have sth like ...
Three Useful Python Bindings - ClamAV, Apt and Evolution

MurreiM

January 5, 2009
This is great! http://www.youtube.com/MurreiM Buy Alli Orlistat online cheap
Filing cabinets 101 - An introduction to disk partitions

sarah

January 5, 2009
I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed ...
This Week: Freedom not Time-Bombs

jnfrlast

January 4, 2009
Hi! http://www.youtube.com/jnfrlast buy cheap viagra online
Filing cabinets 101 - An introduction to disk partitions

Samuel Huckins

January 4, 2009
Great tips! I have had occasion to do a lot of MySQL instance migrations lately, so here is an improvement for Trick 1: mysqldump <DATABASE_NAME> [mysqldump_options] | gzip -c | ...
Five useful command one liners

George Glass

December 31, 2008
I don't really see the point in trying to make linux user-friendly or take over the desktop. We rule the servers the most important element of the entire game. Let ...
Give Linux a chance

bug

December 31, 2008
@Zeth: The hidden field does block some. Not perfect, but it does release some weight from the filtering system, as those are 100% false comments. Acctually, if you would have ...
On Comment Spam

Zeth

December 31, 2008
Hi Eion, Yes that is an interesting approach also. It is the only approach given by default in the stock Django comments module, though it does not stop all comment ...
On Comment Spam

Bug

December 30, 2008
Well... Sadly, and I guess you hate me for it, I use captcha. But at least it's not an image, so even if you visit using w3m [yey!] you can ...
On Comment Spam

Eion

December 30, 2008
Other than server-side processing of comments, I like to add additional <input>'s and hide them in external css. Most of the time the fields are populated by spam-bots, and if ...
On Comment Spam

Nostoc

December 27, 2008
... Mate possible because of the dull Kg8
Ruy Lopez, Berlin defence, open variation

Nostoc

December 27, 2008
My bad, I meant the picture beneath 15, after close inspection my suggestion would be on 18. Instead of 18 : Qe2, I would have taken that knight with my ...
Ruy Lopez, Berlin defence, open variation

Zeth

December 27, 2008
Nostoc, white takes the rook on 15, the rook is a better kill than a knight.
Ruy Lopez, Berlin defence, open variation

Nostoc

December 26, 2008
I'm not that good at chess, but I have a question. At 15, why doesn't white simply take black's knight in C6 with the bishop? It's an easy kill, since ...
Ruy Lopez, Berlin defence, open variation

Zeth

December 26, 2008
CorkyAgain, good question, I don't have a FreeBSD box available at the moment so I can't comment. On Linux at least watch does as I have described.
Five useful command one liners

CorkyAgain

December 25, 2008
Is the watch command you're describing a Linuxism? On my FreeBSD box, "man watch" seems to be describing something completely different.
Five useful command one liners

Binny V A

December 25, 2008
I have actually setup a site to store just short commands... http://txt.binnyva.com/
Five useful command one liners

Bassam essa

December 25, 2008
i try this line command elinks -source "http://www.e51g.com/" > resulthtml.txt its work done :) thx
Command the Web - an ELinks tutorial