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-*
[图片上传失败...(image-3086ab-1542455395321)]
启动mysql服务
systemctl start mysqld
[图片上传失败...(image-61b66a-1542455395321)]
登陆mysql数据库并修改随机密码
mysql5.7启动后,第一次产生随机密码保存在/var/log/mysqld.log中
grep "temp" /var/log/mysqld.log
[图片上传失败...(image-42a74f-1542455395321)]
修改密码为“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模块
[图片上传失败...(image-84d855-1542455395321)]
初始化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
确认是否成功导入:
[图片上传失败...(image-bcbba9-1542455395321)]
配置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
[图片上传失败...(image-c660a8-1542455395321)]
确定http服务支持php
# cd /var/www/html/
# vim index.php
<?php
phpinfo();
?>
# 启动httpd服务
# systemctl start httpd
# 访问ip显示如下
[图片上传失败...(image-f07a99-1542455395321)]
访问zabbix主页面
[图片上传失败...(image-69eb59-1542455547699)]
[图片上传失败...(image-dc6065-1542455547699)]
[图片上传失败...(image-60f34d-1542455547699)]
[图片上传失败...(image-29a2af-1542455547699)]
[图片上传失败...(image-56236a-1542455547699)]
[图片上传失败...(image-eacf78-1542455547699)]
官方默认用户名:Admin,密码:zabbix
[图片上传失败...(image-5c9f90-1542455547699)]
网友评论