Apr 5, 2009

Installing Moodle on Centos 5

I assume that both apache(http) and mysql(database) are on the same server. This is not needed.

1 - Go to moodle.org and download latest moodle*.tgz.
cd /tmp
wget http://download.moodle.org/stable19/moodle-weekly-19.tgz #Do not use this link. Get latest file from http://www.moodle.org/

2 - As root:
yum install php php-mysql httpd mysqlclient10 mysql-server php-gd php-mbstring php-xmlrpc

3 - If your mysql installation is fresh, you will need to assign a root password to it.

service mysqld start

/usr/bin/mysqladmin -u root password 'newpassword'

may assign newpassword as the new mysql root password. Replace newpassword to a safer password.

4 - Start services and be sure that it will be started automatically.
service httpd start
service mysqld start
chkconfig httpd on
chkconfig mysqld on

5 - Create a user moodle with a good password that has all privileges on the table moodle. I suggest that you download and install PhpMyAdmin to do it. Try the latest 2.xx.x.x version as it will work on Centos 5. To use PhpMyAdmin, you will need to create a file named config.inc.php inside PhpMyAdmin instalation folder (/var/www/html/phpmyadmin) with mysql information like root password defined on step 3.

config.inc.php example:

<?
$i = 1;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'newpassword';
?>

After configure PhpMyAdmin, open your favorite browser, point to PhpMyAdmin installation path and:

Privileges -> Add a new user -> Fill the form -> Click on "Create database with same name and grant all privileges" -> Go

Be sure to protect the access to your PhpMyAdmin as it will probably grant root access to anyone that knows its URL. It is a good idea to remove the entire directory after all is working as it is very easy to install it back. Password protect the directory may be good idea too.

6 - Extract files from moodle*.tgz at /var/www/html/moodle.
mkdir /var/www/html/moodle
cd /var/www/html/moodle
tar xvzf /tmp/moodle-weekly-19.tgz

7 - Start your favorite browser and point to your server /moodle directory. Follow installation instructions.
Post a Comment