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

GraphQL vs REST

  GraphQL   GraphQL is an application layer server-side technology which is developed by Facebook for executing queries with existing data. GraphQL can optimize RESTful API calls. It gives a declarative way of fetching and updating your data. GraphQL helps you to load data from server to client. It enables programmers to choose the types of requests they want to make. REST REST is a software architectural style that defines a set of constraints for creating web services. It is designed specifically for working with media components, files, or hardware device. The full form of REST is Representational State Transfer. ========================================================= Here is the important difference between GraphQL and REST. GraphQL REST GraphQL is an application layer server-side technology which is developed by Facebook for executing queries with existing data. REST is a software architectural style that defines a set of constraints for creating Web services. It follow...

DBMS ACID Properties

 1. Atomicity states that database modifications must follow an all or nothing rule 2. Consistency states that only valid data will be written to the database. If, for some reason, a transaction is executed that violates the database's consistency rules, the entire transaction will be rolled back and the database will be restored to a state consistent with those rules.  3. Isolation requires that multiple transactions occurring at the same time not impact each other's execution. For example, if Joe issues a transaction against a database at the same time that Mary issues a different transaction, both transactions should operate on the database in an isolated manner. The database should either perform Joe's entire transaction before executing Mary's or vice-versa. 4.  Durability ensures that any transaction committed to the database will not be lost. Durability is ensured through the use of database backups and transaction logs that facilitate the restoration of committe...

Git Commands

  Git commands sorted. Reference: https://git-scm.com/docs Git task Notes Git commands Tell Git who you are Configure the author name and email address to be used with your commits. Note that Git strips some characters (for example trailing periods) from user.name . git config --global user.name "Sam Smith" git config --global user.email sam@example.com Create a new local repository   git init Check out a repository Create a working copy of a local repository: git clone /path/to/repository For a remote server, use: git clone username@host:/path/to/repository Add files Add one or more files to staging (index): git add <filename> git add * Commit Commit changes to head (but not yet to the remote repository): git commit -m "Commit message" Commit any files you've added with git add , and also commit any files you've changed since then: git commit -a Push Send changes to the master branch of your remote repository: git push origin master Status List the...