Install Moodle Learning Managment System On CentOS 6 - Unixmen
Install Moodle Learning Managment System On CentOS 6 - Unixmen
Install Moodle Learning Managment System On CentOS 6 - Unixmen
Moodle is a Course Management System (CMS), also known as a Learning Management System
(LMS) or a Virtual Learning Environment (VLE). It is a free web application that educators can use to
create effective online/offline learning sites.
In this article, let us learn to build a LMS site with Moodle on CentOS 6.x. Here x stands for version
such as 6.1, 6.2 etc. My testbox hostname and IP address
are server.unixmen.com and192.168.1.200/24 respectively.
Prerequisites
You should install and configure a LAMP server first. Moodle needs the following PHP extensions to
run properly.
[root@server ~]# yum install php-iconv php-mbstring php-curl php-openssl php-tokenizer php-xm
lpc php-soap php-ctype php-zip php-gd php-simplexml php-spl php-pcre php-dom php-xml php-intl
php-json php-ldap php-pecl-apc -y
PHP settings
Open up /etc/php.ini file and make sure that you have configured the settings as shown below:
http://www.unixmen.com/install-moodle-learning-managment-system-on-centos-6/ 1/10
7/22/2014 Install Moodle Learning Managment System on CentOS 6 | Unixmen
Install Moodle
Download the latest version from here. Or you can directly download from the terminal using the
following command:
This will create a new directory called moodle in your current directory. Copy all the contents of
moodle to your website root document folder.
If your server is dedicated to host only moodle site, copy the contents of your moodle directory
http://www.unixmen.com/install-moodle-learning-managment-system-on-centos-6/ 2/10
7/22/2014 Install Moodle Learning Managment System on CentOS 6 | Unixmen
to /var/www/html/ directory. In this case your moodle website URL will be www.your-site.com.
Here I use a sub directory to host my moodle site. So the command should be:
Moodle requires a directory to store all of its files (all your site’s uploaded files, temporary data,
session data etc.). The web server needs to be able to write to this directory. On larger systems
consider how much free space you are going to use when allocating this directory.
IMPORTANT: This directory must NOT be accessible directly via the web. This would be a serious
security hole. Do not try to place it inside your web root or inside your Moodle program files
directory. Moodle will not install. It can go anywhere else convenient.
Open up your web browser and navigate to http://ip-address/ if you copied the moodle directory
contents to Apache document root folder or http://ip-address/moodle if you copied the moodle
directory contents to a sub directory of Apache root.
http://www.unixmen.com/install-moodle-learning-managment-system-on-centos-6/ 3/10
7/22/2014 Install Moodle Learning Managment System on CentOS 6 | Unixmen
http://www.unixmen.com/install-moodle-learning-managment-system-on-centos-6/ 4/10
7/22/2014 Install Moodle Learning Managment System on CentOS 6 | Unixmen
Enter database name and database user details and press Next.
You will be asked to save the settings. The installer will ask you to create a config.php file in your
moodle root folder with the contents of below output.
http://www.unixmen.com/install-moodle-learning-managment-system-on-centos-6/ 5/10
7/22/2014 Install Moodle Learning Managment System on CentOS 6 | Unixmen
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost = 'localhost';
$CFG->dbname = 'moodledb';
$CFG->dbuser = 'moodleadmin';
$CFG->dbpass = 'centos';
$CFG->prefix = 'mdl_';
$CFG->dboptions = array (
'dbpersist' => 0,
'dbsocket' => 0,
);
$CFG->wwwroot = 'http://192.168.1.200/moodle';
$CFG->dataroot = '/var/www/moodledata/';
$CFG->admin = 'admin';
$CFG->directorypermissions = 0777;
http://www.unixmen.com/install-moodle-learning-managment-system-on-centos-6/ 6/10
7/22/2014 Install Moodle Learning Managment System on CentOS 6 | Unixmen
require_once(dirname(__FILE__) . '/lib/setup.php');
Now click Next. And click on Continue to accept the License Agreement.
Now the installer will check for all necessary modules are installed. If everything seems OK, press
Continue.
The moodle installer will create all necessary modules. This will take a while. After it completes
everything, click Continue.
http://www.unixmen.com/install-moodle-learning-managment-system-on-centos-6/ 7/10
7/22/2014 Install Moodle Learning Managment System on CentOS 6 | Unixmen
http://www.unixmen.com/install-moodle-learning-managment-system-on-centos-6/ 8/10
7/22/2014 Install Moodle Learning Managment System on CentOS 6 | Unixmen
It is very important to setup Cron. The Moodle ‘cron’ process is a PHP script that must be run
regularly in the background. The Moodle cron script runs different tasks at differently scheduled
intervals. The Moodle cron script runs tasks include sending mail, updating Moodle reports, RSS
feeds, activity completions, posting forum messages and other tasks. Since different tasks have
different schedules, not every task will run in Moodle when the cron script is triggered.
Now check which user is running the web server using the following command:
# User/Group: The name (or #number) of the user/group to run httpd as.
# . On SCO (ODT 3) use "User nouser" and "Group nogroup".
# suggested workaround is to create a user www and use that user.
User apache
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid. This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
http://www.unixmen.com/install-moodle-learning-managment-system-on-centos-6/ 9/10
7/22/2014 Install Moodle Learning Managment System on CentOS 6 | Unixmen
<IfModule mod_userdir.c>
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
UserDir disabled
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disabled" line above, and uncomment
#UserDir public_html
# Control access to UserDir directories. The following is an example
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{User-agent}i" agent
#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
From the above result, apache user is running the web server. So let us set the cron job for apache
user:
The above command will run cron job every 15 minutes intervals on all day. Make sure that you have
replaced with your own moodle path. Save and exit the file.
Go through the Moodle documentation page to know more about Moodle installation and
administration.
http://www.unixmen.com/install-moodle-learning-managment-system-on-centos-6/ 10/10