LAMP与zabbix4.0 环境部署

LAMP与zabbix4.0 环境部署

环境

关闭防火墙,Selinux

systemctl stop firewalld
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0

LAMP环境部署

yum -y install http mariadb mariadb-server mariadb-devel php-fpm php
vim /var/www/html/index.php
	<?php
		phpinfo();
	?>
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

systemctl restart httpd php-fpm  mariadb
systemctl enable httpd php-fpm mariadb
mysql_secure_installation 	# 初始化mariadb
mysql -uroot -p   # 能够正常登录
reboot
http://192.168.50.66/index.php    # 测试是否能够正常解析php

补充:
apache的web目录在:/var/www/html

安装zabbix4.0.

rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
yum clean all 
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

## 如果出现下面的情况
## failed to link /usr/share/zabbix/fonts/graphfont.ttf -> /etc/alternatives/zabbix-web-font: No such file or directory

## 进行解决
## 在windows里面找一个显示中文的字体文件复制到服务器中

mkdir /usr/share/zabbix/fonts
mv SIMHEI.TTF /usr/share/zabbix/fonts/graphfont.ttf
ln -s /usr/share/zabbix/fonts/graphfont.ttf /etc/alternatives/zabbix-web-font

创建,配置zabbix

1.创建zabbix库,并授权用户

mysql -uroot -p123456
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@'%' identified by '123456';
msyql> flush privileges

2.解压zabbix数据库文件并导入数据库


# 方法1:
gunzip /usr/share/doc/zabbix-server-mysql*/create.sql.gz
mysql -uroot -p zabbix >/usr/share/doc/zabbix-server-mysql*/create.sql

# 方法2:
gunzip /usr/share/doc/zabbix-server-mysql*/create.sql.gz
mysql -uroot -p123456
mysql> use zabbix;
mysql> source create.sql;
mysql> show tables;

# 方法3:
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

  1. 复制zabbix-web端文件到httpd默认目录下
# 移动文件到web根目录
cp -rp /usr/share/zabbix  /var/www/html/

启动各项服务

systemctl restart zabbix-server zabbix-agent httpd php-fpm mariadb
systemctl enbale zabbix-server zabbix-agent httpd php-fpm mariadb

访问网页,从网页进行安装

在这里插入图片描述

出现上图,按照要求进行设置相关配置文件
主要的配置文件有:
/etc/php.ini
/etc/httpd/conf.d/zabbix.conf

当全部为绿色后就可以进行下一步
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述在这里插入图片描述
在这里插入图片描述

登录的时候,默认账户名Admin,密码zabbix
注意: 图片可能是其他版本的,但不影响操作

参考文献
zabbix安装官方参考
zabbix图像配置参考

解决Zabbix server is not running :the information displayed may not be current.

在登录了zabbix首页之后,可能在底部会出现
Zabbix server is not running :the information displayed may not be current.

可能出现的原因:

  • 防火墙阻止了nginx服务
  • 数据库授权有问题
  • zabbix的web配置文件配置问题
  • dns的解析问题

1.防火墙

# 关闭防火墙和selinux
systemctl status firewalld
systemctl stop firewalld
systemctl disabled firewalld

# 关闭selinux
setenforce 0   # 临时关闭
sed -i '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config

2.更改zabbix的web配置文件
配置文件名:zabbix.conf.php
可以通过find / -name "zabbix.conf.php"查找,之后按照下图进行修改

3.数据库授权
一般问题不会在这,因为安装之前已经授权了,但由于刚才修改了web文件,需要重新授权

mysql -uroot -p123456
mysql> grant all privileges on zabbix.* to zabbix@'%' identified by 123456;
mysql> flush privileges;
mysql> exit

4.检查dns,并修改
1.修改DNS
vim /etc/hosts
2.重启nginx
systemctl restart nginx

5.检查配置文件

vim /etc/zabbix/zabbix_server.conf
DBHost=192.168.50.66
DBName=zabbix
DBUser=zabbix
DBPassword=123456

6.重启服务
systemctl restart zabbix-agent.service zabbix-server.service httpd php-fpm.service mariadb

7.登录web界面
http://192.168.50.66/zabbix

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Richie-Hao

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值