Introduction

Moodle is an open-source learning management system (LMS) used to create and manage online learning platforms. This guide explains how to install Moodle on an Ubuntu server using Apache, PHP-FPM, and MySQL.

Prerequisites

  • Ubuntu server with root or sudo access
  • Apache web server
  • MySQL server
  • PHP 5.5 with PHP-FPM
  • Internet connectivity to download Moodle and required packages

Implementation

Step 1

Install Apache, MySQL, PHP, and PHP-FPM.

apt-get install apache2 mysql-server php5 libapache2-mod-fastcgi php5-fpm

Step 2

Install the required Moodle dependencies.

apt-get install graphviz aspell php5-pspell php5-curl php5-gd php5-intl php5-mysql php5-xmlrpc php5-ldap git-core

Step 3

Enable the required Apache proxy modules.

cp -p /etc/apache2/mods-available/proxy.* /etc/apache2/mods-enabled/

cp -p /etc/apache2/mods-available/proxy_fcgi.load /etc/apache2/mods-enabled/

Step 4

Configure the Apache Virtual Host by adding the following:

ProxyPassMatch ^/(..php(/.)?)$ fcgi://127.0.0.1:9000/var/www/html/$1

Step 5

Configure PHP-FPM.

Edit:

/etc/php5/fpm/pool.d/www.conf

Comment:

listen = /var/run/php5-fpm.sock

Add:

listen = 127.0.0.1:9000

Step 6

Reload Apache.

service apache2 reload


Moodle Installation

Step 7

Download the Moodle source code.

cd /opt

git clone git://git.moodle.org/moodle.git

cd moodle

Step 8

List the available branches.

git branch -a

Step 9

Check out the required Moodle stable version.

git branch –track remotes/origin/MOODLE_31_STABLE origin/MOODLE_31_STABLE

git checkout MOODLE_31_STABLE

Step 10

Copy the Moodle files to the Apache document root.

cp -R /opt/moodle/* /var/www/html/

Step 11

Create the Moodle data directory.

mkdir /var/moodledata

Step 12

Assign the required permissions.

chown -R www-data /var/moodledata

chmod -R 777 /var/moodledata

chmod -R 0755 /var/www/html/moodle

Step 13

Reload Apache.

service apache2 reload


MySQL Configuration

Step 14

Edit the MySQL configuration file.

File:

/etc/mysql/my.cnf

Under the [mysqld] section, add:

default-storage-engine = innodb

Step 15

Restart MySQL.

service mysql restart

Step 16

Log in to the MySQL shell and create the Moodle database.

CREATE DATABASE IF NOT EXISTS moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Step 17

Create the Moodle database user.

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodle_user@localhost IDENTIFIED BY ‘passwordformoodle_user’;


Complete the Installation

Step 18

Set the required permissions.

chmod -R 777 /var/www/

Step 19

Open the following URL in your web browser.

http://

Step 20

During the Moodle installation wizard, provide the following database details:

  • Database Type: mysqli
  • Host Server: localhost
  • Database: moodle
  • Username: moodle_user
  • Password: passwordformoodle_user
  • Table Prefix: mdl_

Step 21

Complete the installation by entering the administrator account details.

Step 22

After the installation is complete, update the directory permissions.

chmod -R 755 /var/www/html

Conclusion

Moodle is now installed and configured on the Ubuntu server using Apache, PHP-FPM, and MySQL. After completing the installation, verify that the Moodle application is accessible through the web browser and that the administrator account can successfully log in to manage the learning platform.

Leave a Reply