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

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

gutes Qualitätscasino

July 3, 2009
The paragraph is the most basic block in a reST document. Paragraphs are simply chunks of text separated by one or more blank lines. As in Python, indentation is significant ...
An Introduction to ReStructuredText

sreejith

July 3, 2009
I want to download a file from remote server in binary format. Can anyone let me know the command to do so? Thanks in advance
PuTTY Series: Using PSFTP

jythlkedl;rg

July 2, 2009
????? ??? ????????? ?????? ?? ???????? ? ????????? ???, ? ??????? ??? ??????? ??????? ? ??? ?? ???? ?? ?? ????? ???????????????? ??????????????????. ??????????????????? ????? ?? ?? ????, ?, ???, ...
Burning an iso to CD on Windows

gbi-service-ru

July 1, 2009
???? ?????????, ?????????? ?? ?? ? ???"??? ??????, ?????????? ??? ?? ???? ? ????, ? ? ?????. ?? ??? ???? ???? ??? ???. ?? ?????????? ???? ?? ?. ???????? ?, ...
Burning an iso to CD on Windows

seo techniques

July 1, 2009
I would like to thank you for the inforamtion you have put on this article no matter.
Only the penitent man will pass - on captchas and cotton wool

Online Craps lernen

July 1, 2009
I would like to thank you for the making these clarifications in such a detailed manner to rebuilt the communication and enhancing the strategies of the organization which could be ...
Disclaimer: NO WARRANTY

ZK@Web Marketing Blog

July 1, 2009
Django is an amazing web framework; we built a lot of features in a very short period of time and Django [mostly] stayed out of our way. Last night as ...
Baby Steps with Django - Part 4 Django Applications and flow

overnight payday loans

July 1, 2009
I found commandline.org.uk very informative. The article is professionally written and I feel like the author knows the subject very well. commandline.org.uk keep it that way.
Only the penitent man will pass - on captchas and cotton wool

Drogo

June 30, 2009
Gotta agree with your sentiments about many modern games. The cost of a new game is prohibitive, especially for consoles (although I've noticed that PS2 games have crashed in price ...
Retro British Gaming - Part 3: Amstrad CPC Games

pppiohooddd

June 29, 2009
Free vadult video site! http://crech.us/ 1000 free video every day!
OpenSolaris, Gobuntu, and be careful who you kiss

Tesyimasystus

June 29, 2009
...Love this dude!!! http://www.esnips.com/doc/79c22395-7bd6-4299-92db-cf392e381698/kutiman---this-is-what-it-became Peace
5 Homebrew Python Games

Simon Tite

June 28, 2009
twitterfall is still there, I just tried it, and to me it beats Visible Tweets hands down. Problem with Visible Tweets: * Extremely **irritating** animations! (There are three available, but ...
Visualising your favourite keywords in Twitter

piffAltetle

June 28, 2009
??? ??? ???? ???????????? ??????,?????????? ???? ?????? ??????????? ???????,??????????? ????? mp3,??????? ??????????? ??????.
Encrypt your /home this Christmas: part three - moving your data to the encrypted partition

idhyougjdsyhfr

June 26, 2009
SMS Trap is something that never fails to help you get your partner off guard? Our software will make reading other people?s SMS as easy as ABC. Ready for some ...
Burning an iso to CD on Windows

Sozdanie-saitov-com

June 26, 2009
???? ???????? ? ?????????????????? ????????????? - ??? - ???? ?? ????? ?????. ???? ?? ??? ? ??????? ?????? ????????? ?????! ???, ?????23126 sozdanie-saitov.com@mail.ru
Burning an iso to CD on Windows

gameskillz

June 26, 2009
Killzone 2 - the best PS3 game yet?Still LittleBigPlanet for me, but Sony's new shooter is mightily impressive. What you think about my web? http://www.easyfaxlesspaydayloan.com/payday-loans-online.html
Email Syntax Check in Python

Anish

June 25, 2009
hey Moritz, Check this http://commandline.org.uk/python/my-merry-five-minutes-with-bazaar/
Setting up a bazaar server

gbi zavod 177

June 24, 2009
???? ?????????, ?????????? ?? ?? ? ???"??? ??????, ?????????? ??? ?? ???? ? ????, ? ? ?????. ?? ??? ???? ???? ??? ???. ?? ?????????? ???? ?? ?. ???????? ?, ...
Burning an iso to CD on Windows

vettone

June 24, 2009
??? ????? ????? ????,??????? ?? ???,????? ???? ???.????? ?? ??????????? ????,?????????? ?????? ???????? ?? ????.???? ????????: http://euro-football.ucoz.com ????? ???? ??????????.
Burning an iso to CD on Windows

tuegjhg78kjfhuey

June 23, 2009
? ???????????????? ???? ??? ???, ?? ?????? ?? ?????????, ???, ???????????????? ??? ??????????, ???? ????? ??? ??? http://remont.ucoz.ua/
Burning an iso to CD on Windows