In this post, we are trying to cover up how to install on plain ubuntu server. We are going to use Apache 2.4.7 with PHP FPM 5.5.9 for the moodle application to run on ubuntu host.

Install the dependent packages.

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

Install other dependencies for moodle application to run.

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

Configure PHP FPM in Apache using mod_proxy_fcgi

Enable 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/

 

Add under the Apache Virtual host:

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

Make PHP FPM to listen on TCP port instead of default Unix Socket:

vi /etc/php5/fpm/pool.d/www.conf
Comment the line “listen = /var/run/php5-fpm.sock”
Add the line
Restart Apache Service
/etc/init.d/apache2 reload
Moodle Installation:

Clone the stable version of Moodle from Github:

cd /opt

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

cd moodle

sudo git branch -a [list all the branches of the git repo]

sudo git branch --track remotes/origin/MOODLE_31_STABLE origin/MOODLE_31_STABLE

sudo git checkout MOODLE_31_STABLE

 

Copy the moodle files to Apache document root and setup the directory structure:

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

sudo mkdir /var/moodledata

sudo chown -R www-data /var/moodledata

sudo chmod -R 777 /var/moodledata

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

 

Reload apache2 Service.

service apache2 reload

 

MySQL setup:

Make innodb the default storage engine by editing “/etc/mysql/my.cnf” and adding the line “default-storage-engine = innodb” under the [mysqld] section and under Basic Settings.

 

Restart Mysql Service

service mysql restart

Login to mysql prompt and let’s create the database for moodle.

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

Create DB 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 setup:

chmod -R 777 /var/www/ 

Take the URL in your browser:

http://<IP address of your server>

Installation steps:

On installation setup, select/mention the below details.

Database Type: choose mysqli

Database Settings:

Host server: localhost
Database: moodle
User: moodle_user
Password:passwordformoodle_user

Tables Prefix: mdl_

Enter Admin login details during the installation process.

Modify the installation directory permission

chmod -R 755 /var/www/html

Leave a Reply