RedHat Linux installation

Revision as of 11:51, 21 June 2005 by Przemyslaw Stencel (talk | contribs) (added step 7)

Jump to: navigation, search

Note : These instructions apply to RedHat version 8. They have also been found to work for RedHat 9.0 and for Fedora Core 1 and 2. Fedora Core 3 requires the php-gd package in addition to php. I see no reason why they should not work for later versions, but....

FIRST: RTFM!! Please read carefully the Moodle installation documentation at

Redhat installation considerations: There are many installation options available when installing Redhat. I assume that you are installing on a server and will have selected a Server type install. There is however no reason why this should not work on a desktop or Workstation installation.

STEP 1: Make sure you have installed the following packages.

(You will need to select the option to customize the default set of packages on installation OR bring up the package manager by putting disk 1 back in the drive for an existing system):

  • X Windows System (not vital but easier)
  • Gnome or KDE desktop environment (as above)
  • Server Configuration Tools
  • Web Server
    • Click "Details" and make sure all PHP modules are ticked (except ODBC and PGSQL, they're not neccesary)
    • make sure not to miss the MYSQL-PHP module (not installed by default)
  • SQL Database
    • Click "Details" and tick MySQL server box
  • Also make sure you set up the firewall. You probably only need to enable HTTP (and perhaps FTP and SSH) access to your server machine, unless you know different.

STEP 2: Download Moodle...

(I will install under /usr/moodle, data in /usr/moodle_data)

  • Download your favourite version of Moodle from (.zip archive is easiest)
  • as Root create folder under /usr and copy zip
    • su
    • mkdir /usr/moodle
    • mkdir /usr/moodle_data
    • cp /usr/moodle
  • If you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file..
    • cd /usr/moodle
    • cvs login
    • cvs -z3 co moodle

STEP 3: Unpack and set file permission etc.

  • Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.
    • cd /usr/moodle
    • unzip
    • mv moodle mymoodle
      • (optional step - I have more than one install under /usr/moodle)
    • mkdir /usr/moodle_data/mymoodle
      • (same name as the moodle install above)
    • chown -R apache:apache /usr/moodle
      • (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)
    • chown -R apache:apache /usr/moodle_data

STEP 4: Setup config.php

  • Still as root copy and edit the config file, you should know the host/domain name for your server
    • cd /usr/moodle/mymoodle
    • cp config-dist.php config.php
    • vi config.php (or whatever your favourite editor is!)
  • Your config.php settings should be something like...
    • dbtype = "mysql"
    • dbhost = "localhost"
    • dbname = "mymoodle"
    • dbuser = "moodleuser"
    • dbpass = "moodlepass" (<-- better make this something of your own)
    • prefix = ""
      • (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)
    • wwwroot = "http://myhost.mydomain/mymoodle"
      • (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")
    • dirroot = "/usr/moodle/mymoodle"
    • dataroot = "/usr/moodle_data/mymoodle"
  • Save your changes and exit from the editor

STEP 5: Setup MySQL

  • First you need to get the MySQL daemon running, it is not running by default.
    • On the Desktop find and launch "Services" (on KDE and Gnome it's under System Settings=>Server Settings=>Services, but you might have to hunt around).
    • Tick the box for MySQL and (with it selected) press the Start icon - ensure it starts up
    • Choose "Save Changes" from the menu, and exit the program.
  • If you haven't yet, as root, change the MySQL root password
    • mysqladmin -u root password mysqlpass (<-- should change this to something of your own)
  • Next, set up the MySQL database (see for more details)
  • Launch MySQL as root
    • mysql -u root -p
      • (at the password prompt, enter the password from above)
  • At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')
    • CREATE DATABASE mymoodle;
      • (the name 'mymoodle' is the same name as the database from Step 4)
      • (as above, 'mymoodle' is from Step 4)
    • TO moodleuser@localhost IDENTIFIED BY 'moodlepass';
      • ('moodleuser' and 'moodlepass' are from Step 4)
    • quit
  • Still as root, reload MySQL
    • mysqladmin -p reload
  • (! Consider MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)

STEP 6: Setup Apache

  • Edit the Apache configuration file at /etc/httpd/conf/httpd.conf
  • Right at the end of the file add the following lines: (once again 'mymoodle' as from Step 3)
    • <Directory "/usr/moodle/mymoodle">
    • DirectoryIndex index.php
    • AcceptPathInfo on
    • AllowOverride None
    • Options None
    • Order allow,deny
    • Allow from all
    • </Directory>
    • Alias /mymoodle "/usr/moodle/mymoodle"
  • Don't insert a space in "allow,deny" (common mistake!)
  • You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.
  • Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.

STEP 7: Set up the cron job.

  • As root user type the command:
    • crontab -e
  • Add the following line (you need to know vi, 'o' adds a line in vi):
    • */5 * * * /usr/bin/wget -g -O /dev/null httphttp://localhost/mymoodle/admin/cron.php
      • (change the URL as appropriate for your site)
  • Save the file and exit (in vi that is <Esc>, then ':wq')