Installing Moodle 3.2 on Centos 6

March 26, 2017 - Hacking
Installing Moodle 3.2 on Centos 6




Let’s install Moodle 3.2 on Centos 6


First we must take care of system requirements, we need PHP 5.6.5, Mysql 5.5.31 and some specific PHP and Mysql modules.


Centos 6.8 comes with PHP 5.3.3 available on the official repository, we will have to install a new version.


First remove all PHP software:

yum remove php*


Install EPEL:

yum install epel-release.noarch




rpm -Uvh remi-release-6*.rpm


Enable Remi repo:

cd /etc/yum.repos.d

edit remi.repo

Make sure “[remi-php56]” section is enabled

As you can see the Notice tell’s you that you need remi-safe also enabled, since dependencies are there, so edit remi-safe.repo and make sure it is enabled.


Now all you need to do is install PHP like you usually do “yum install php …” and it will install the 5.6 version

Install the following PHP packages needed for Moodle:

yum install php-iconv php-mbstring php-curl php-openssl php-tokenizer 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 php-mysql php-mcrypt php php-xmlrpc php-opcache


Centos 6 Mysql version is also not enough, so we need to install a new version.

Remove Mysql:

yum remove mysql*


We will use remi‘s repo as well to install a higher version:

yum –enablerepo=remi,remi-test install mysql mysql-server


Run mysql_secure_installation for minimum security


Now login to mysql

mysql -u root -p


Let’s create the Moodle database:

create database moodledb;


Create user “moodleadmin” with password “superstrong” with full permissions on this database ONLY:

GRANT ALL PRIVILEGES ON moodledb.* TO ‘moodleadmin’@localhost IDENTIFIED BY ‘ superstrong ‘;


Now reload permissions table:

flush privileges;


We must also make sure that the following settings are set on mysql config file ( /etc/my.cnf )


default-character-set = utf8mb4


innodb_file_format = Barracuda

innodb_file_per_table = 1


 character-set-client-handshake = FALSE

character-set-server = utf8mb4

collation-server = utf8mb4_unicode_ci


default-character-set = utf8mb4



Download Moodle and untar files:


tar xzvf moodle-3.2.2.tgz

cd moodle

cp –a * /var/www/html/moodle

chown –R apache:apache /var/www/html/moodle

chmod –R 755 /var/www/html/moodle


Create the Data directory for Moodle:

mkdir -p /var/www/moodledata

chown -R apache:apache /var/www/moodledata

chmod -R 755 /var/www/moodledata


Now we can start Moodle installation by navigating to http://ip-address/moodle or any other address you setup pointing to moodle’s  document root


It will check for all the necessary components, if something’s missing you must correct it:

Follow the instructions and you’ll have Moodle installed in no time.

Please follow and like me at:

Leave a Reply

Your email address will not be published. Required fields are marked *