一.环境搭建(Apcahe+php+mysql)
1.Apache
a.安装epel源 yum install epel-release
b.安装 yum install httpd
c.启动 systemctl start httpd
d.查看状态 systemctl status httpd
APache根目录在/var/www/html
2.php安装
yum -y install php
记得启动php服务
3.MySQL安装
yum -y install mysql
4.进入网站下载Moodle:https://moodle.org/
解压文件至/var/www/html内
tar -zxvf 软件名 /var/www/html
5.提前部署mysql数据库
systemctl start mysqld //启动mysql服务
CREATE DATABASE moodle;
CREATE USER 'moodlea'@'%' IDENTIFIED BY 'moodleadmin';
GRANT ALL PRIVILEGES ON moodle.* TO 'moodleadmin'@'%';
FLUSH PRIVILEGES;
6.更改/var/www/html/moodle/config.php内容
unset($CFG); // Ignore this line
global $CFG; // This is necessary here for PHPUnit execution
$CFG = new stdClass();
$CFG->dbtype = 'mysqli'; // 'pgsql', 'mariadb', 'mysqli', 'mssql', 'sqlsrv' or 'oci'
$CFG->dblibrary = 'native'; // 'native' only at the moment
$CFG->dbhost = 'IP地址'; // eg 'localhost' or 'db.isp.com' or IP
$CFG->dbname = '数据库名称'; // database name, eg moodle
$CFG->dbuser = '数据库账号'; // your database username
$CFG->dbpass = '数据库密码'; // your database password
$CFG->prefix = 'mdl_'; // prefix to use for all table names
$CFG->dboptions = array(
'dbpersist' => false, // should persistent database connections be
// used? set to 'false' for the most stable
// setting, 'true' can improve performance
// sometimes
'dbsocket' => false, // should connection via UNIX socket be used?
// if you set it to 'true' or custom path
// here set dbhost to 'localhost',
// (please note mysql is always using socket
// if dbhost is 'localhost' - if you need
// local port connection use '127.0.0.1')
'dbport' => '', // the TCP port number to use when connecting
// to the server. keep empty string for the
// default port
);
7.进入网址:http://IP/moodle进行安装,缺什么yum 去补,restart命令去重启服务
然后就是愉快的配置,最后给moodle配置一些插件!!!
完成