最小化安装 centos 8.1
#hostnamectl set-hostname moodle.example.com
#vi /etc/systemconfig/network-script/ifcfg-ens192
修改IP地址、DNS、domain
#vi /etc/sysconfig/selinux
SELINUX=disabled
#firewall-cmd --permanent --add-service={http,https}
#firewall-cmd --reload
#yum install mariadb mariadb-server
#systemctl enable --now mariadb
#vi /etc/my.cnf.d/mariadb-server.cnf
末尾添加
innodb_file_format = Barracuda
innodb_file_per_table = 1
#mysql_secure_installation
设置root密码
#mysql -u root -p
>CREATE DATABASE mymoodle CHARSET 'utf8mb4';
>GRANT ALL ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';
>flush privileges;
>quit
从moodle.org下载moodle最新版 moodle-3.8.1.tgz
#mkdir /usr/moodle
#mkdir /usr/moodle_data
#cp moodle-3.8.1.tgz /usr/moodle
#cd /usr/moodle
#tar xvfz moodle_xxx.zip
#mv moodle mymoodle
#mkdir /usr/moodle_data/mymoodle
#chown -R apache:apache /usr/moodle
#chown -R apache:apache /usr/moodle_data
#cd /usr/moodle/mymoodle
#cp config-dist.php config.php
#vi config.php
$CFG->dbtype = 'mariadb';
$CFG->dbhost = 'localhost';
$CFG->dbname = 'mymoodle';
$CFG->dbuser = 'moodleuser';
$CFG->dbpass = 'moodlepass';
$CFG->prefix = 'mdl_';
$CFG->wwwroot = 'http://mylhost/mymoodle';
$CFG->dataroot = '/usr/moodle_data/mymoodle';
#yum install httpd
#systemctl enable --now httpd
#vi /etc/httpd/conf.d/moodle.conf
添加如下内容
Alias /mymoodle /usr/moodle/mymoodle
#httpd 2.4
#Require host localhost
Require all granted
#httpd 2.2
Order deny,allow
Deny from all
Allow from localhost
安装php
#yum install php php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap
#systemctl restart httpd
通过http://myserver/mymoodle运行安装向导,完成moodle安装
#crontab -e
添加如下内容
*/5 * * * * /usr/bin/php /usr/moodle/mymoodle/admin/cli/cron.php