zabbix安装

发布时间 2023-09-19 14:05:50作者: 枫飘过的天1


1.关闭selinux和防火墙

   setenforce 0
   vi /etc/selinux/config
   selinux=disabled
   systemctl stop firewalld.service
   systemctl disable firewalld.service
2.安装LAMP
   (1)安装apache
   yum install -y httpd && systemctl enable httpd && systemctl start httpd
   (2)安装mysql(参考mysql安装,不建议使用yum安装)
   yum install -y mariadb mariadb-server
   systemctl enable mariadb && systemctl start mariadb
   (3)安装php
   yum install -y php php-mysql
3.安装zabbix
   配置网络yum源:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
   (1)下载源
   rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
   (2)安装zabbix
   yum install -y zabbix-server-mysql zabbix-get zabbix-web zabbix-web-mysql zabbix-agent zabbix-sender
   (3)创建一个zabbix库并设置为utf8的字符编码格式
   create database zabbix character set utf8 collate utf8_bin;
   grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
   //grant all privileges on zabbix.* to zabbixuser@'%' identified by 'zabbixpass';
   flush privileges;
   (4)导入表
   cd /usr/share/doc/zabbix-server-mysql-3.2.10/
   gunzip create.sql.gz
   mysql
   >use zabbix
   >source create.sql
   (5)配置zabbix server配置文件
   vi /etc/zabbix/zabbix_server.conf
   DBHost=localhost
   DBName=zabbix
   DBUser=zabbixuser
   DBPassword=zabbixpass
   DBSocket=/tmp/mysql.sock #该路径find / -name mysql.sock查看本地sock路径
   DBPort=3306
   #systemctl start zabbix-server && systemctl enable zabbix-server //设置开机启动
   (6)配置php
   vi /etc/httpd/conf.d/zabbix.conf (添加一行)
   # php_value date.timezone Europe/Riga
   php_value date.timezone Asia/Shanghai
   systemctl restart httpd
4.登录zabbix网址设置
   http://192.168.213.200/zabbix (注意用户创建问题)
   登陆账户是Admin、密码是zabbix
5.安装过程中问题处理
   (1) 设置中文:右上角人图像,language改成Chinese(zh_CN)
   (2) 对服务器自身监控:配置,主机,停用的改成启用
   (3) 解决中文乱码无法正常显示问题:
        拷贝windows系统字体,cd /usr/share/zabbix/fonts 
        mv graphfont.ttf graphfont.ttf.bak
       mv simhei.ttf graphfont.ttf (将拷贝字体文件改名为graphfont.ttf)

   (4) 报错:zabbbix server is not running

       解决办法:参考链接https://blog.csdn.net/fake_hydra/article/details/83061765
       防火墙问题:setenforce 0 selinux 设置为disabled
       数据库没有设置密码,mysql_secure_installation 设置密码即可
       zabbix server is not running: the information displayed may not be current
       参考链接:https://www.cnblogs.com/rusking/p/4441362.html