Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Opensource»How to Setup Moodle 2.8 on CentOS/RHEL 7/6/5

    How to Setup Moodle 2.8 on CentOS/RHEL 7/6/5

    By RahulDecember 29, 20143 Mins Read

    Moodle is an Open Source Course Management System, It’s also known as a Learning Management System (LMS) or a Virtual Learning Environment (VLE). This tutorial will help you to install Moodle on CentOS/RHEL Systems

    Advertisement

    Installing Required Packages

    Install order to setup Moodle we need a Web Server, Database Server and PHP with required modules. Use below link to install following packages.

    Installing Apache, MySQL and PHP on CentOS/RedHat 6/5

    Install required PHP modules using yum package manager.

    # yum install git php-common php-mysql php-gd php-intl php-curl
    # yum install php-ldap php-apc php-mbstring php-dom php-soap php-xmlrpc
    

    To install git version 1.9 use article Install Git 1.9 on CentOS/RHEL

    Download Moodle Latest Source

    Moodle complete code is available under git repository. So we can directory make a clone of repository to our local system using following commands.

    # mkdir /var/moodle
    # cd /var/moodle
    # git clone git://git.moodle.org/moodle.git www
    

    After finishing Moodle git clone, checkout the latest branch of Moodle available in git. At the time of updating this article current Moodle version is 2.8.3 so we specified in below command.

    # cd www
    # git checkout origin/MOODLE_28_STABLE
    

    Click here to find latest available version of Moodle.

    Create Moodle Data directory using following command. Moodle use this directory for storing data of application. We recommend to keep this directory outside of Moodle application.

    # mkdir /var/moodle/data
    

    Create Moodle Database in MySQL

    Moodle supports MySQL 5.1.33, Postgres 8.3, MSSQL 2005, Oracle 10.2 or its higher versions. For this tutorial we are using MySQL.

    Use below commands to create Moodle database and user to access database.

    # mysql -u root -p
    
    mysql> CREATE DATABASE moodle;
    mysql> GRANT ALL ON moodle.* TO 'moodle'@'localhost' IDENTIFIED BY 'secretpassword';
    mysql> FLUSH PRIVILEGES;
    mysql> quit
    

    Create Moodle Configuration File

    Create Moodle configuration file by creating copy of config-dist.php with name config.php in www directory.

    # cd /var/moodle/www
    # cp config-dist.php config.php
    

    Now edit config.php and make following changes as per you setup details.

    $CFG->dbtype    = 'mysqli';
    $CFG->dblibrary = 'native';
    $CFG->dbhost    = 'localhost';
    $CFG->dbname    = 'moodle';
    $CFG->dbuser    = 'moodle';
    $CFG->dbpass    = 'secretpassword';
    $CFG->prefix    = 'mdl_';
    $CFG->wwwroot   = 'http://moodle.tecadmin.net';
    $CFG->dataroot  = '/var/moodle/data';
    

    Configure Web Server VirtualHost

    Add a virtual host in Apache configuration file /etc/httpd/conf/httpd.conf like below.

    <VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot /var/moodle/www
        ServerName moodle.tecadmin.net
        CustomLog logs/moodle.tecadmin.net_log combined
    </VirtualHost>
    

    Updating Moodle web and data directory permissions so that web server can write in it.

    # chown -R apache:apache /var/moodle
    # chmod -R 755 /var/moodle
    

    Restart Apache Server to reload newly changes made.

    # service apache restart
    

    Finally Start Moodle Web Installer

    Open Moodle url in browser and follow the steps to complete setup.

    moodle-1

    Checking required modules are installed.

    moodle-2

    Installing all Moodle modules. Click continue when complete.

    moodle-3

    You will get few more steps while running web installer complete all the steps. Finally you will get Moodle running like below.

    moodle-4

    configuration lvs Moodle MySQL PHP setup
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Installing PHP on Pop!_OS

    How to Install PHP 8.x on Pop!_OS

    Managing Dependencies with Composer: A Beginner’s Guide

    (Resolved) MySQL connection error: certificate verify failed

    View 1 Comment

    1 Comment

    1. Scott on May 28, 2014 3:40 am

      Nice notes. Quick update for those using these…
      You’ll also need to include the base php app:
      yum install php -y
      The default startup for apache on centos is “httpd” not apache. (the account name is apache though)
      You’ll also need to change the DocumentRoot to: (in httpd.conf)
      DirectoryIndex index.php index.html index.html.var
      Finally, author is right, you will need to either disable selinux (not recommended) or allow selinux pages.
      Hope this helps everyone and thanks for the author for writing up what he has. It was a quick install from that.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • System.out.println() Method in Java: A Beginner’s Guide
    • Split Command in Linux With Examples (Split Large Files)
    • Test Your Internet Speed from the Linux Terminal
    • 11 Practical Example of cat Command in Linux
    • sleep Command in Linux with Examples
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.