踩风火轮的乌龟 2020-02-16
关闭防火墙,Selinux
systemctl stop firewalld sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config setenforce 0
LNMP环境所需要的安装包如下。主要以rpm包为主。不是源码安装
[ ~]# rpm -qa | grep nginx nginx-1.16.0-1.el7.ngx.x86_64 [ ~]# rpm -qa |grep php php-common-5.4.16-46.el7.x86_64 php-5.4.16-46.el7.x86_64 php-cli-5.4.16-46.el7.x86_64 php-fpm-5.4.16-46.el7.x86_64 php-pdo-5.4.16-46.el7.x86_64 php-mysql-5.4.16-46.el7.x86_64 [ ~]# rpm -qa | grep mysql mysql-community-common-5.7.26-1.el7.x86_64 mysql-community-release-el7-7.noarch mysql-community-libs-5.7.26-1.el7.x86_64 mysql-community-server-5.7.26-1.el7.x86_64 mysql-community-client-5.7.26-1.el7.x86_64 mysql-community-libs-compat-5.7.26-1.el7.x86_64
详细的LNMP搭建参考:LNMP搭建详解
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 zabbix-get zabbix-web zabbix-sender ## 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
1.创建zabbix库,并授权用户
mysql -uroot -p123456 mysql> create database zabbix character set utf8 collate utf8_bin; mysql> grant all privileges on zabbix.* to '%' identified by '123456'; msyql> flush privileges
2.解压zabbix数据库文件并导入数据库
gunzip /usr/share/doc/zabbix-server-mysql*/create.sql.gz # 方法1: mysql -uroot -p zabbix >/usr/share/doc/zabbix-server-mysql*/create.sql # 方法2: 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 # 移动文件到web根目录 cp -rp /usr/share/zabbix/ /usr/share/nginx/html/
systemctl restart mysqld nginx zabbix-server.service zabbix-agent.service php-fpm systemctl enable mysqld nginx zabbix-server.service zabbix-agent.service php-fpm
出现上图,按照要求进行设置相关配置文件
主要的配置文件有:
/etc/php.ini
/etc/httpd/conf.d/zabbix.conf
当全部为绿色后就可以进行下一步
登录的时候,默认账户名Admin
,密码zabbix
参考文献:zabbix安装官方参考
参考文献:zabbix图像配置参考
没有任何显示或者显示人看不懂的,表明存在乱码,需要进行解决
1.在window拷贝一个能显示中午的字体文件到zabbix-server的/usr/share/zabbix/fonts目录下面,注意字体文件的权限
2.制作字体文件名改为graphfont.ttf软连接
mv /usr/share/nginx/html/zabbix/fonts/SIMHEI.TTF ./fonts/graphfont.ttf
3.重启服务
systemctl restart zabbix-agent.service zabbix-server.service nginx php-fpm.service mysqld.service
在登录了zabbix首页之后,可能在底部会出现Zabbix server is not running :the information displayed may not be current.
可能出现的原因:
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 '%' identified by 123456; mysql> flush privileges; mysql> exit
4.检查dns,并修改
1.修改DNSvim /etc/hosts
2.重启nginxsystemctl 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 nginx php-fpm.service mysqld.service
7.登录web界面http://192.168.50.66/zabbix