In this tutorial we’ll learn how to install Moodle on CentOS 7. We will also install and configure its prerequisites. Moodle (acronym of Modular-object-oriented dynamic learning environment) is a free and open source learning management system built to provide teachers, students and administrators single personalized learning environment.
I recommend to use a minimal CentOS server setup as a basis for the tutorial, that can be a virtual or a root server image with an CentOS 7 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install Moodle on CentOS 7
Step 1. First, ensure your system is fully up-to-date by running the following:
yum -y update
Step 2. Installing LAMP on CentOS 7.
You should check out this LAMP stack install tutorial for CentOS 7, if you haven’t installed LAMP yet. Once it’s installed, come back here and read on. We also will install the required packages for LAMP stack and the important PHP extension that Moodle relies on:
yum install php70w php70w-dom php70w-mbstring php70w-gd php70w-pdo php70w-json php70w-xml php70w-zip php70w-curl php70w-mcrypt php70w-pear
Step 3. Installing Moodle.
Next, we need to download Moodle from their official website:
wget https://download.moodle.org/download.php/stable34/moodle-latest-34.zip unzip moodle-latest-34.zip -d /var/www/html
Make a ‘moodledata’ directory for the files that are created by the Moodle interface. This directory should be created outside the publicly available area:
Now just set the right permissions for the folders:
chown -R apache:apache /var/www/moodledata chown -R apache:apache /var/www/html/moodle
Step 4. Create a database for Moodle.
Next, we need to create a database for the Moodle installation:
mysql -uroot -p
Run the following command to create a database for Moodle:
MariaDB> CREATE DATABASE moodle; MariaDB> GRANT ALL PRIVILEGES ON moodle.* TO 'moodleuser'@'localhost' IDENTIFIED BY 'PASSWORD'; MariaDB> FLUSH PRIVILEGES; MariaDB> exit
Step 5. Accessing Moodle.
Now you can access the Moodle web install wizard in your browser by navigate to http://<yourdomainhere>/moodle (or <serveripaddress>/moodle to continue your Moodle installation. 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.