Centos7+PHP5.6+MySQL5.7+Zabbix4.0部署

Centos7+PHP5.6+MySQL5.7+Zabbix4.0部署

  • 系统版本:CentOS Linux release 7.4.1708 (Core) 最小化安装
  • 内核版本:3.10.0-693.el7.x86_64

1、安装http服务

~]# yum install httpd

修改http配置文件以支持php服务

# cd /etc/httpd/conf

编辑 httpd.conf 文件时要注意:         

1):    
AddType  application/x-compress .Z    
AddType application/x-gzip .gz .tgz    
在后面添加:    
AddType application/x-httpd-php .php(使Apcche支持PHP)    
AddType application/x-httpd-php-source .php5       

2)
找到:    <IfModule dir_module>    DirectoryIndex index.html    </IfModule>    
添加:    <IfModule dir_module>    DirectoryIndex index.html index.php    </IfModule>        
3)
找到:    #ServerName www.example.com:80    
修改为:  ServerName 127.0.0.1:80或者ServerName localhost:80

2、安装php服务

利用webstatic的官方yum源进行php的安装

# 安装yum源
yum install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

# 安装php56版本
yum install php56w php56w-opcache

3、安装MySQL数据库

安装mysql服务

# 下载MySQL安装包,解压后删除minimal相关的rpm包后yum安装
wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.23-1.el7.x86_64.rpm-bundle.tar
yum install mysql-community-*

1542453554922

启动mysql服务

systemctl start mysqld

1542453702492

登陆mysql数据库并修改随机密码

mysql5.7启动后,第一次产生随机密码保存在/var/log/mysqld.log中

grep "temp" /var/log/mysqld.log

1542453798411

修改密码为“1qaz@WSX”,自行设定

mysql> alter user root@localhost identified by '1qaz@WSX';

4、安装zabbix服务

可以直接参考:https://www.zabbix.com/download 官网进行安装

# rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent

# 配置好webstatic的yum源,会自动解决zabbix依赖的相关php模块

1542454088384

初始化zabbix数据库:

# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
mysql> quit;

# 导入zabbix数据库
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

确认是否成功导入:

1542454319772

配置zabbix服务:

# cd /etc/zabbix/
# vim zabbix_server.conf

# grep -Ev "^#|^$" zabbix_server.conf 
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBName=zabbix
DBUser=zabbix
DBPassword=1qaz@WSX
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000

修改zabbix关于httpd的配置文件

# cd /etc/httpd/conf.d/
# vim zabbix.conf

1542454633127

确定http服务支持php

# cd /var/www/html/
# vim index.php
<?php
phpinfo();
?>

# 启动httpd服务
# systemctl start httpd

# 访问ip显示如下

1542454835949

访问zabbix主页面

IP:http://ip/zabbix/setup.php

1542454926388

1542454943396

1542454975258

1542455006611

1542455016059

1542455025268

官方默认用户名:Admin,密码:zabbix

1542455052707

posted @ 2018-11-17 19:58  午夜爬虫  阅读(1905)  评论(0编辑  收藏  举报