2013-07-02

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 how-to 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 and 192.168.1.200/24 respectively.

Prerequisites

You should install and configure a LAMP server first. Moodle needs the following php extensions to run properly.

PHP Settings

Open up /etc/php.ini file and make sure that you have configured the settings as shown below.

Restart your web server.

Create MySQL Database and user for Moodle

Here i create a database ‘moodledb’ and a user ‘moodleadmin’ with password ‘centos’.

Install Moodle

Download the latest version from here. Or you can directly download from the Terminal using the following command.

Extract the downloaded zip file.

This will create a 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 to /var/www/html/ directory. In this case your moodle website URL will be www.your-site.com.

If your server is shared server, copy the contents of moodle directory to /var/www/html/moodle/. In this case your moodle website URL will be www.your-site.com/moodle.

Here i use a sub directory to host my moodle site. So the command should be:

Set the following permissions for root user to moodle directory.

Create Data directory for Moodle

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.

Begin Moodle Installation

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.

Choose your desired language and press Next.

Enter Moodle data directory path and Press Next.

Select the Database driver. In my case its mysql. Press Next.

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.

So let us create a config.php file with follwoing command.

Add the lines from the above output as shown below.

Now click Next. Now click on Continue to accept the License agreement.

Now the installer will check for all necessory modules are installed. If everything seems Ok, press Continue.

The moodle installer will create all necessary modules. This will take a while. After complete everything, click Continue.

Create a administrator account and click Update.

Enter the Site name and click Save Changes button.

Now your moodle site has been successfully installed.

Setup Cron for Moodle

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.

Install crontab package if it is not installed before.

Now check which user is running the web server using the following command.

This will display a result as shown below.

From the above result, apache user is running the web server. So let us set the cron job for apache user.

Add the followong line.

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.

---------------------------------------------------------------------
Install Moodle Learning Managment System On CentOS 6

Show more