CentOS7.4にMoodle3.3をインストール

MariaDBインストール

$ sudo vim /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
$ sudo yum install MariaDB-server MariaDB-client
gpgcheck=1

$ sudo systemctl enable mariadb.service
$ sudo systemctl start mariadb.service

MariaDB設定

$ sudo mysql_secure_installation
$ sudo mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.1.28-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database moodle default character set utf8;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on moodle.* to moodle@localhost identified by '****';
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> quit;
Bye

$ sudo vi /etc/mysql/my.cnf
[mysqld]
innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_large_prefix

Apacheインストール

$ sudo yum install httpd httpd-devel mod_ssl
$ sudo systemctl enable httpd

Apace設定

$ sudo /etc/httpd/conf/httpd.conf
DirectoryIndex index.php index.html index.htm

HTTPアクセス許可

$ sudo firewall-cmd --add-service=http --zone=public --permanent
$ sudo firewall-cmd --add-service=https --zone=public --permanent
$ sudo firewall-cmd --reload

PHPインストール

$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
$ sudo yum install --enablerepo=remi,remi-php56 php php-devel php-mbstring php-pdo php-gd php-xml php-mcrypt php56-php-mysqlnd php56-php-intl php56-php-xmlrpc php56-php-soap php56-php-ldap php56-php-opcache
$ sudo yum install aspell graphviz ghostscript

PHP設定

$ sudo vim /etc/php.ini
;889行目
date.timezone = 'Asia/Tokyo'
;1660行目
mbstring.language = Japanese
;1667行目
mbstring.internal_encoding = UTF-8
;1675行目
mbstring.http_input = pass
;1685行目
mbstring.http_output = pass

Moodle設定

$ tar -zxvf moodle-latest-33.tgz
$ sudo mv /var/www/html/moodle
$ sudo mkdir /var/www/moodledata
$ chmod -R 755 /var/www/
$ chown -R apache:apache /var/www/
$ /var/www/html/moodle

$ sudo mv config-dist.php config.php

$ sudo vim config.php
$CFG->dbtype    = 'mariadb';
$CFG->dbuser    = 'moodle';
$CFG->dbpass    = '****';
$CFG->wwwroot   = 'http://xxxx/';
$CFG->dataroot  = '/var/www/moodledata';

$ sudo systemctl start httpd