美文网首页
马哥Linux第十七周

马哥Linux第十七周

作者: Liang_JC | 来源:发表于2020-06-14 17:14 被阅读0次

Q1、部署分离的LAMP,部署到二台服务器上,php加载xcache模块

环境:2台主机 server-A 192.168.37.7 server-B 192.168.37.17

#server-A
[root@Centos7 ~]# yum install httpd php php-mysql php-devel php-mbstring -y
[root@Centos7 ~]# vim /etc/php.ini
date.timezone = Asia/Shanghai 
[root@Centos7 ~]# wget http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz
[root@Centos7 ~]# tar xf xcache-3.2.0.tar.gz -C /usr/local/src
[root@Centos7 ~]# cd /usr/local/src/xcache-3.2.0/
[root@Centos7 xcache-3.2.0]# phpize --clean && phpize
[root@Centos7 xcache-3.2.0]# ./configure --enable-xcache
[root@Centos7 xcache-3.2.0]# make && make install
[root@Centos7 xcache-3.2.0]# cp xcache.ini /etc/php.d/
[root@Centos7 xcache-3.2.0]# systemctl start httpd
[root@Centos7 xcache-3.2.0]# vim /var/www/html/info.php
<?php
phpinfo();
?>

#server-B
[root@Centos7 ~]# yum install mariadb-server -y
[root@Centos7 ~]# systemctl start mariadb

验证:http://192.168.37.7/info.php

image.png

Q2、部署wordpress论坛,并实现正常访问登录论坛。

#server-A
[root@Centos7 ~]# yum install httpd php php-mysql php-devel php-mbstring -y
[root@Centos7 ~]# vim /etc/php.ini
date.timezone = Asia/Shanghai 
[root@Centos7 ~]# wget http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz
[root@Centos7 ~]# tar xf xcache-3.2.0.tar.gz -C /usr/local/src
[root@Centos7 ~]# cd /usr/local/src/xcache-3.2.0/
[root@Centos7 xcache-3.2.0]# phpize --clean && phpize
[root@Centos7 xcache-3.2.0]# ./configure --enable-xcache
[root@Centos7 xcache-3.2.0]# make && make install
[root@Centos7 xcache-3.2.0]# cp xcache.ini /etc/php.d/
[root@Centos7 xcache-3.2.0]# systemctl start httpd
[root@Centos7 ~]# tar xf wordpress-5.1.4-zh_CN.tar.gz -C /var/www/html
[root@Centos7 ~]# cd /var/www/html
[root@Centos7 html]# chown apache:apache wordpress/
[root@Centos7 html]# cd wordpress/
[root@Centos7 wordpress]# cp wp-config-sample.php wp-config.php
[root@Centos7 wordpress]# vim wp-config.php
/** WordPress数据库的名称 */
define( 'DB_NAME', 'wordpress' );

/** MySQL数据库用户名 */
define( 'DB_USER', 'wpuser' );

/** MySQL数据库密码 */
define( 'DB_PASSWORD', 'centos' );

/** MySQL主机 */
define( 'DB_HOST', '192.168.37.17' );

#server-B
[root@Centos7 ~]# yum install mariadb-server -y
[root@Centos7 ~]# systemctl start mariadb
[root@Centos7 ~]# mysql -e "create database wordpress;grant all on wordpress.* to wpuser@'192.168.37.%' identified by 'centos';flush privileges;"

验证:http://192.168.37.7/wordpress

image.png

Q3、收集apache访问日志,并实现图形化展示。

#server-A
[root@Centos7 wordpress]# yum install php-gd rsyslog-mysql -y
[root@Centos7 wordpress]# tar -xf ~/loganalyzer-4.1.10.tar.gz -C ~/
[root@Centos7 wordpress]# cd ..
[root@Centos7 html]# cp -r ~/loganalyzer-4.1.10/src/ logs
[root@Centos7 html]# touch logs/config.php
[root@Centos7 html]# chmod 666 logs/config.php

[root@Centos7 html]# vim /etc/rsyslog.conf
$ModLoad ommysql
*.info;mail.none;authpriv.none;cron.* :ommysql:192.168.37.17,Syslog,loguser,centos
[root@Centos7 html]# scp /usr/share/doc/rsyslog-8.24.0/mysql-createDB.sql 192.168.37.17:/root
[root@Centos7 html]# vim /etc/httpd/conf/httpd.conf
    #Options Indexes FollowSymLinks
    DirectoryIndex index.php index.html
[root@Centos7 html]# setfacl -Rm u:apache:rwx logs/
[root@Centos7 html]# systemctl restart httpd rsyslog

#server-B
[root@Centos7 ~]# mysql < /root/mysql-createDB.sql
[root@Centos7 ~]# mysql -e "grant all on Syslog.* to loguser@'192.168.37.%' identified by 'centos';flush privileges;"
[root@Centos7 ~]# mysql -e "use Syslog;show tables"
+------------------------+
| Tables_in_Syslog       |
+------------------------+
| SystemEvents           |
| SystemEventsProperties |
+------------------------+

安装 loganalyzer: http://192.168.37.7/logs/install.php

image.png
image.png
image.png
image.png
image.png

主页查看:http://192.168.37.7/logs/index.php

image.png

相关文章

  • 马哥Linux第十七周

    Q1、部署分离的LAMP,部署到二台服务器上,php加载xcache模块 环境:2台主机 server-A 192...

  • 文件系统常用命令:cd命令

    为方便马哥学员的理解和使用,马哥linux运维团队特别做了《马哥Linux命令大全锦集》,命令是集合了马哥教育学员...

  • 马哥linux第二周

    Q1、描述Linux发行版的系统目录名称命名规则以及用途。 命名规则: 文件名最长255个字节 包括路径在内文件名...

  • 马哥Linux第五周

    Q1、查找/etc目录下大于1M且类型为普通文件的所有文件 Q2、打包/etc/目录下面所有conf结尾的文件,压...

  • 马哥Linux第七周

    Q1、简述osi七层模型和TCP/IP五层模型 OSI七层模型7、应用层网络进程访问应用层:为应用程序进程提供网络...

  • 马哥Linux第九周

    Q1、编写脚本,接受二个位置参数,magedu和/www,判断系统是否有magedu,如果没有则自动创建maged...

  • Linux开发被大数据云计算带火啦让我门一起学习Linux教程大

    视频下载地址 Linux运维 马哥教程Liunx新 马哥2016linux就业班+架构班+运维班全套新 dubbo...

  • 马哥Linux第十五周

    Q1、编写脚本,支持让用户自主选择,使用mysqldump还是xtraback全量备份。 Q2、配置Mysql主从...

  • 马哥Linux第十二周

    Q1、配置chrony服务,实现服务器时间自动同步 Q2、实现cobbler+pxe自动化装机 客户端测试: 新建...

  • 马哥Linux第十九周

    Q1、简述lvs四种集群特点及使用场景 lvs-nat:修改请求报文的目标IP,多目标IP的DNAT本质是多目标I...

网友评论

      本文标题:马哥Linux第十七周

      本文链接:https://www.haomeiwen.com/subject/zngxxktx.html