Install Moodle 3.3 on CentOS 7

/ Category: Tutorials / Comments: None

moodle 3.3. on centos 7
Spread the love

We’ll show you, how to Install Moodle 3.3 on CentOS 7. Moodle, short for Modular Object-Oriented Dynamic Learning Environment) is a free, open source, PHP-based platform. It is a very powerful education management system mostly used by teachers, tutors or trainers to create and manage online courses for individuals or groups. This is why Moodle is also known as a Learning or Course Management system. Moodle can run on any server with PHP, a web server (Apache, nginx) and a SQL-type database. In this tutorial, we will show you how to install Moodle 3.3 on your machine running CentOS 7.

PHP Version

But before we begin, there is a prerequisite to installing Moodle. It requires PHP version 5.6.5 or higher in order for it to work. Since CentOS 7 comes with PHP 5.4, this means that Moodle will not work with the default version of PHP. So, we will install PHP 5.6 in order to meet the requirements needed.

DISCLAIMER: While it’s very likely that everything will work fine after updating your PHP version, it’s important to know that this is NOT a 100% safe method of installing PHP, since it requires adding a third-party repository. DO THIS AT YOUR OWN RISK. Upgrading your PHP version can cause problems with already existing software and websites that you have on your machine. Therefore, if you do this, it is highly recommended that you do it on a machine or server that is not being shared with software that has to be 100% reliable. If your PHP version is already 5.6.5 or greater, you do not need to do these next few steps.

First, we need to add a repository that has PHP 5.6 available for download. In this case, we’ll use Webtatic:

rpm -Uvh

We now need to remove the old version of PHP currently installed on our machine:

yum -y remove php php-common

Now we can install the new version of PHP through the new repository by executing (A lot of these are mandatory PHP plugins for Moodle):

yum -y install php56w php56w-mysql php56w-xml php56w-gd

You can also install these optional plugins that aren’t mandatory, but are recommended by Moodle.

yum -y install php56w-opcache php56w-mbstring php56w-xmlrpc php56w-soap php56w-intl

Once you have installed the new version of PHP, feel free to remove the third-party repository (Optional, but recommended):

yum -y remove webtatic-release

If you’d like to revert your PHP version back to its previous version, execute the following commands (Note: This will also remove all plugins shown earlier):

yum -y remove php56w php56w-common php56w-mysql php56w-xml php56w-gd php56w-opcache php56w-mbstring php56w-xmlrpc php56w-soap php56w-intl
yum -y install php

Moodle Installation

To begin, we need to download Moodle from their official website. Go to your /tmp directory, then download the zip file:

cd /tmp

If you do not have the unzip package, install it with the following command:

yum -y install unzip

Unzip the compressed Moodle file to your Apache document root directory:

unzip -d /var/www/html

Delete the downloaded zip file:

rm -f

Make a ‘moodledata’ directory for the files that are created by the Moodle interface. This directory should be created outside the publicly available area:

mkdir /var/www/moodledata

The Moodle directories should be owned by the Apache user. You can find your Apache user by executing:

grep -Ri '^user' /etc/httpd/conf/httpd.conf

This is what should be returned:

User apache

Change the owner of the Moodle directories to the apache user:

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

Create a MySQL database for your Moodle installation:

mysql -u root -p <your root mysql password here>

CREATE USER 'moodleuser'@'localhost' IDENTIFIED BY '<insert new password here>';
GRANT ALL PRIVILEGES ON moodledb.* TO 'moodleuser'@'localhost';

After this is done, restart Apache so that all changes take effect:

systemctl restart httpd

Now, open your web browser, navigate to http://<yourdomainhere>/moodle (or <serveripaddress>/moodle) and carefully follow the instructions. You will be prompted to enter the MySQL user and password that you made, after which you will configure your main administrator account which will have complete control over the site.

Note: On the off-chance that you get an error message stating that ‘Unicode is required to be installed/enabled’ during the installation, you can convert your MySQL database using these commands:

mysql -u root -p <your root mysql password here>


Don’t forget to restart Apache after doing this for the changes to take effect.

If you have completed the steps above, then you should now have a working Moodle installation.

Of course, you don’t have to follow this guide if you use one of our Linux Cloud VPS Hosting services, in which case you can simply ask our expert Linux admins to install this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, please share it with your friends through social networks by using the buttons below, or simply leave a comment. Thanks.

Be the first to write a comment.

Your feedback