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

Cupcake

July 31, 2010
Good post! You helped me a lot with my school project! CountryField(blank = True) < (K)
Countries in Django

LeshaShampoo

July 30, 2010
it was very interesting to read commandline.org.uk I want to quote your post in my blog. It can? And you et an account on Twitter?
Email Syntax Check in Python

vemma2018

July 30, 2010
I find myself coming to your blog more and more often to the point where my visits are almost daily now!
On Comment Spam

layecenda

July 30, 2010
Hello. And Bye.test :) http://idfjhvihdfiphvlajbvhalibv.com
PuTTY Series: Adding PuTTY to your system path

scuba

July 30, 2010
I’ve been visiting your blog for a while now and I always find a gem in your new posts. Thanks for sharing.
On Comment Spam

Businesking

July 30, 2010
Great site and articles for hack for win, I said Amazing post
How not to program WSGI

Tehnoking

July 30, 2010
This is Great post to learn about the hack Thumbs-up for you :D
How not to program WSGI

Syabiltech

July 30, 2010
I think this articles for master...because very hard to learning, As blogger beginners like me.
How not to program WSGI

coffeeatea

July 30, 2010
Are you looking for coffee gifts? We can tell you more about the coffee gifts including coffee machines and coffee pods.
Introducing Soturi - yet another Django blog application

noni juice

July 30, 2010
I just sent this post to a bunch of my friends as I agree with most of what you’re saying here and the way you’ve presented it is awesome.
On Comment Spam

Dion Moult

July 29, 2010
What I do know is that ever since I tried out Opera and put their tab bar on the left as a column, I've loved that layout. Back on Firefox ...
We need a thoughout integration of the desktop and the web - not Tab Candy superfast jellyfish

ZonaEntertainment

July 29, 2010
Wow useful articles, I'm read to learn about this and now I bookmark this to my Facebook, thanks for share!
How not to program WSGI

Giacomo

July 29, 2010
Honestly, I think both Mozilla and you are wrong :) This sort of concept adds overhead. A user would have to manage all this crap, constantly dragging and dropping, creating ...
We need a thoughout integration of the desktop and the web - not Tab Candy superfast jellyfish

Matija "hook" Šuklje

July 29, 2010
As a minimalist, you'll probybly moan if I mention KDE, but I'll do so anyway ;) The future I want (and actually see slowly fold out before me) is to ...
We need a thoughout integration of the desktop and the web - not Tab Candy superfast jellyfish

tahitian noni

July 28, 2010
Thank You For This Blog, was added to my bookmarks.
On Comment Spam

Rick

July 28, 2010
I already have piles. It's called A New Window.
We need a thoughout integration of the desktop and the web - not Tab Candy superfast jellyfish

Tech News

July 25, 2010
Thanks for this short tutorial...was auto-FTPing my files from my appserver to webserver for my tech news website. Everything was OK until someone hacked it. Hosting provider is now recommending ...
SFTP in Python: Really Simple SSH

naypalm

July 24, 2010
During the past 3-4 years, I and many others have enjoyed unlimited 2G/3G internet. But ever since the massive cult-like following of i Phone users in the US, most cellular ...
Calling time on mobile internet nonsense?

Steve

July 15, 2010
Very occasionally, you will run into a Java program that uses a lot of memory just to hold all the classes used. It turns out that the JVM uses a ...
Three classic command line tips

no

July 14, 2010
1. number one 2. number two 4. number four 3. number three 6. number six # first # second ## second-ay ## second-bee ### second-bee-one ### second-bee-two
An Introduction to ReStructuredText