Skip to main content

HOW TO: Install Moodle 3.0 - 3.5 in CentOS 6/7

Here are the commands for installing Moodle 3.0 - 3.5 in CentOS 6/7.

1. Update your System

$ yum update -y$ sudo yum update -y  (for Ubuntu 16.04/18.04)
2. Install required LAMP(Linux, Apache, MySQL, phpmyadmin) version on CentOS 6/7

$ yum install httpd mariadb mariadb-server php php-mysql $ sudo
yum install httpd mariadb mariadb-server php php-mysql (for Ubuntu 16.04/18.04) $ yum install php-iconv php-mbstring php-curl php-openssl php-tokenizer php-xmlpc 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
(use sudo for Ubuntu 16.04/18.04)
Start httpd and mysql services for CentOS
$ systemctl enable httpd
$ systemctl start  httpd
$ systemctl enable mariadb
$ systemctl start MariaDB
(use sudo for Ubuntu 16.04/18.04)

$ sudo service httpd restart
$ sudo service MariaDB restart

Create root admin password of MySQL, or later you can configure the path,  username and password of DB in Moodle/config.php. Also, you need to create a config.php file if it's not created during Moodle installation. The file will be available as config-dist.php. At the end of the commands you can find the config.php file and edit them according to the path and other credentials.
# mysqladmin -u  root password password


Create a database and a database user and assign all privileges to that newly created database user.
Sample output
# mysql -u root -p 
MariaDB [(none)]> create database moodle;
MariaDB [(none)]> create user 'unixmen'@'localhost' identified by 'password';
MariaDB [(none)]> grant all priviledges on moodle.* to 'unimxmen'@'localhost';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit
Bye



Download latest version of Moodle, replace accordingly like 3.0 - 3.5. Here I've installed Moodle 3.4v.
$ cd  /var/www/html
$ wget https://download.moodle.org/stable34/moodle-3.4.tgz
$ tar -xvf moodle-3.4.tgz
$ chown -R apache:apache /var/www/html/moodle
$ chmod -R 755 /var/www/html/moodle

(use sudo for Ubuntu 16.04/18.04)
In next step you've to create moodledata folder which will be used by Moodle to store caches and data for later migration usage. Under /var/www/ make a folder as  ‘moodledata’ which will be used by moodle, change permissions (chmod) and ownership (chown) for that directory as required.
$ cd /var/www/
$ mkdir moodledata 
$ chmod -R 755 /var/www/moodledata
$ chown -R apache:apache /var/www/html/moodledata


Restart httpd services or apache
$ systemctl restart httpd
$ sudo service apache2/httpd restart ----> for Ubuntu
/var/www/html/moodle/config.php
<?php  // Moodle configuration file
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype    = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = moodle;
$CFG->dbuser    = 'username';
$CFG->dbpass    = 'password';
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => '',
  'dbsocket' => '',
  'dbcollation' => 'utf8mb4_general_ci',
);
$CFG->wwwroot   = 'http://localhost/moodle';
$CFG->dataroot  = '/var/www/moodledata';
$CFG->admin     = 'admin';
$CFG->directorypermissions = 0777;
require_once(__DIR__ . '/lib/setup.php');
// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!

Comments

Popular posts from this blog

HOW-TO:- Solve Moodle 2.7 on MySql 5.7.x Installation

The reason of doing this is I configured my apache for local virtual hosting rather than localhost (available in the next post). I found the error as mentioned below, and I tried different solution to solve it. I did few of the things to solve, they are as follows: Removed and installed MySQL server. Installed mysql 5.7v Installed Moodle 2.7+ stable version  configured and deleted Moodle config.php few times. created and deleted database naming moodle(default created when initialized) and few other names. Gave permission to php5.6 instead of php7.0.2 in Ubuntu 16.04 Here's the Solution, find below lines(183 - 191) or search for " SELECT @@storage_engine " and then replace it from "SELECT @@default_storage_engine" . =======Code Snippets(183 - 191):  =======         // get the default database engine         $sql = " SELECT @@default_storage_engine";         $...

Software Versions You Must Have..!

Google Chrome       Version 29 and Version 37 of Google Chrome works much better than any other version.I updated my Google Chrome but it was lagging,not responding, crashed,contents were loaded very slow and few more.So,finally I found Google Chrome 37 working better,bugs fixed and you can download this to fix the previous problems. 2. KM Player Really awesome player to watch HD Videos,movies.Compatible with all extensions of videos you want to watch whether it is mkv,3gp,flv,HD,4K etc.KM Player has very good 3D mode.You can watch multiple videos at a time.I found version 3.6 & 3.9 useful,but in between versions were very Ads providing, lagging every time when you open the Player. 3. iTunes & Quick Time Player  Hats off to the creator 'Apple Inc.'. iTunes- name is enough.I use default audio player as iTunes.You can feel the sound clarity when you are changing it to other mode like Pop,Rock,Acoustic,Bass etc. iT...

#EspoCRM #Business #Open_Source

Since last few weeks I'm working on EspoCRM - open source business software. I'll edit the post with explanation. just a quick backup. Ref. here:  ORM, How to manage entities and perform queries - EspoCRM Documentation Here are some steps to get started: Here's how you can incorporate your custom search.js script for the Lead entity in a "upgrade safe" way while your pull request is approved: Define your own search.js class in the custom namespace. for example: client/custom/src/views/record/search.js Code: define('custom:views/record/search', 'views/record/search', function (Dep) { return Dep.extend({ WRITE HERE ALL YOUR CUSTOM SEARCH CODE }); }); Define a custom header list view class that will invoke the custom search instead of the core class, for example: client/custom/src/views/header/list.js Code: define('custom:views/header/list', 'views/list', function (Dep) { return Dep.extend({ searchView: 'cu...