Wednesday, December 7, 2011

e-Learning :Moodle Linux Server setup

 









Introductions:
Hello Technos!
This would be a great learning stuffs for you to have an on-line learning website

Requirements:
Software:
moodle 2.2
mysql 
php
apache2 

Hardware:
Server CPU (Optiplex 755 QCore )

Objectives:
To test moodle software
To deploy e-learning website

Methodology:
1) Install softwares:
root@localhost# yum install httpd*
root@localhost# yum install php*
root@localhost# yum install  mysql*
root@localhost# wget htp://
root@localhost# cp moodle-latest-2.2.tar.gz /var/www/

2) configure Apache2
root@localhost# vim /etc/httpd/conf/httpd.conf

2.a) Add the following php settings:
2.a.1)Module
# Use for PHP 5.x:
LoadModule php5_module modules/libphp5.so
AddHandler php5-script .php 
2.a2) Index format
# Add index.php to your DirectoryIndex line:
DirectoryIndex index.html index.php
AddType text/html .php
# PHP Syntax Coloring
# (optional but useful for reading PHP source for debugging):
AddType application/x-httpd-php-source phps
2.a3) PHP File handling







2.b) Add/change  the following web directories:
DocumentRoot  /var/www/html 
Document Root "/var/www/moodle"
3) conffigure php
root@localhost# vi /etc/php.ini
3.a)
Add the following entries: 
extension=mysql.so
extension=gd.so
memory_limit=40M
post_max_size = 80M
upload_max_filisize=80M

4) configure mysql
4.a) If its your first time to open mysql
root@localhost# mysqladmin -u root -p yourpassword
root@localhost# mysql -u root -p

4.b) Edit my.cnf , use unicode (UTF-8 format)
root@localhost# vim /etc/my.cnf
Add the following entries 
[client]
default-character-set=utf8
[mysqld] 
default-character-set=utf8
default-collation=utf8_unicode_ci
character-set-server=utf8
collation-server=utf8_unicode_ci

4.c)create database for moodle
root@localhost#  mysql> create database moodle;
root@localhost# mysql > exit;

5) installing  the moodle software
5.a)Let us disable secure linux for a while so that apache is able to create directory
via webpage
root@localhost# echo 0 >/selinux/enforce
root@localhost# chown -R apache:apache/var/www/
root@localhost# chown -R apache:apache/var/www/moodle
root@localhost# cd /var/www/
root@localhost# tar -zxvf moodle-latest.tar.gz

5.b)  browse http://localhost/
         browse http://ip_address

Below are the pictures  details:
Details(0)


Details(1)


Details(2)


Details(3)


Details(4)












Details(5)
 












Details(6)
 











Details(7)


Details(8)
 













  Details(9)


Remarks:
Problem 1:
Web page cannot create a (/var/www/moodledata ) directory
Solution 1: (off security linux for a while)
set off selinux

Solution 2: (enable web directory writability)
chown 777  /var/www/

Solution 3: (apache ownership of the file [permission])
chown -R apache:apache /var/www/
chown -R apache:apache /var/www/moodle
chown -R apache:apache /var/www/moodledata 

Problem 2:
Cannot load mysql for UTF-8 unicode format

Solution 1:(mysql configuration)
edit /etc/my.cnf

Solution 2: (brute force mysql for setting utf-8)

Problem 3:
SELinux is preventing /usr/sbin/httpd from write access on the directory /var/www/moodledata.

Plugin: catchall
you want to allow httpd to have write access on the moodledata directoryIf you believe that httpd should be allowed write access on the moodledata directory by default.
You should report this as a bug.
You can generate a local policy module to allow this access.
Allow this access for now by executing:
root@localhost# grep httpd /var/log/audit/audit.log | audit2allow -M mypol
root@localhost# semodule -i mypol.p

Conclusions: