本笔记是基于CentOS 7.2下最小化安装的操作系统搭建的Zabbix4.0环境,主要用于做一些企业路由器和交换机等设备的运行状态监控。

1、安装epel源

centos7.2下快速安装zabbix4.0
  1. yum -y install epel-release

2、安装php-fpm和mariadb

centos7.2下快速安装zabbix4.0
  1. yum -y install php-fpm mariadb mariadb-server wget

3、配置zabbix4.0源(我这里主要使用的是清华大学的zabbix镜像源)

centos7.2下快速安装zabbix4.0
  1. wget -/etc/yum.repos.d/ http://down.whsir.com/downloads/zabbix.repo

4、安装zabbix4.0

centos7.2下快速安装zabbix4.0
  1. yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

5、启动mariadb

centos7.2下快速安装zabbix4.0
  1. systemctl enable mariadb
    systemctl start mariadb

6、配置mariadb(创建zabbix数据库,默认密码为空,直接enter)

centos7.2下快速安装zabbix4.0
  1. mysql -u root -p
centos7.2下快速安装zabbix4.0
  1. MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
    MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'www.pengqi.club';
    MariaDB [(none)]> quit

7、导入zabbix数据库

centos7.2下快速安装zabbix4.0
  1. zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pwww.pengqi.club zabbix

8、修改zabbix-server配置文件

centos7.2下快速安装zabbix4.0
  1. vi /etc/zabbix/zabbix_server.conf
centos7.2下快速安装zabbix4.0
  1. DBHost=localhost
    DBName=zabbix
    DBUser=zabbix
    DBPassword=www.pengqi.club

9、修改http配置文件,修改时区为亚洲上海

centos7.2下快速安装zabbix4.0
  1. vi /etc/httpd/conf.d/zabbix.conf
centos7.2下快速安装zabbix4.0
  1. php_value date.timezone Asia/Shanghai

10、启动相关应用服务并设置开机启动

centos7.2下快速安装zabbix4.0
  1. systemctl enable php-fpm
    systemctl start php-fpm
    systemctl enable httpd
    systemctl start httpd
    systemctl enable zabbix-server
    systemctl start zabbix-server
    systemctl enable zabbix-agent
    systemctl start zabbix-agent

11、访问web页面初始化安装zabbix4.0(http://你的IP地址/zabbix/)

centos7.2下快速安装zabbix4.0

centos7.2下快速安装zabbix4.0

centos7.2下快速安装zabbix4.0

温馨提示:

1、需要关闭 selinux,一定要关闭这个,开启selinux会引起一连串问题。

centos7.2下快速安装zabbix4.0
  1. sed -"s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

2、关闭防火墙

centos7.2下快速安装zabbix4.0
  1. systemctl start firewalld.service#启动firewall
    systemctl stop firewalld.service#停止firewall
    systemctl disable firewalld.service#禁止firewall开机启动

 

添加被监控服务器(添加zabbix-agent)

 

  • 安装zabbix-agent客户端

wget -/etc/yum.repos.d/ http://down.whsir.com/downloads/zabbix.repo

yum install -y zabbix-agent

  • 编辑修改配置文件

grep -n '^'[a-Z] /etc/zabbix/zabbix_agentd.conf
vim /etc/zabbix/zabbix_agentd.conf

13:PidFile=/var/run/zabbix/zabbix_agentd.pid
32:LogFile=/var/log/zabbix/zabbix_agentd.log
43:LogFileSize=0
98:Server=192.168.144.113         //zabbix服务器地址
139:ServerActive=192.168.144.113   //活跃服务器地址
150:Hostname=test
268:Include=/etc/zabbix/zabbix_agentd.d/*.conf
  • 关闭防火墙,启动服务

systemctl stop firewalld.service
setenforce 0
systemctl enable zabbix-agent.service
systemctl restart zabbix-agent.service

netstat -anpt | grep zabbix //监听在10050端口

centos7.2下快速安装zabbix4.0
centos7.2下快速安装zabbix4.0
centos7.2下快速安装zabbix4.0
centos7.2下快速安装zabbix4.0
centos7.2下快速安装zabbix4.0

 
参考文章:https://www.pengqi.club/blog/288.html
参考文章:https://blog.51cto.com/13659253/2165146
参考文章:https://www.zhouzhifei.com/?p=153

相关文章:

  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2021-09-18
  • 2021-12-08
  • 2021-09-06
  • 2022-02-23
猜你喜欢
  • 2022-12-23
  • 2021-12-27
  • 2021-05-25
  • 2021-05-26
  • 2021-07-10
  • 2022-12-23
  • 2021-09-13
相关资源
相似解决方案