「Zabbix」- 安装(CentOS)

  CREATED BY JENKINSBOT

本笔记整理在 CentOS 中部署 Zabbix 的过程,大致步骤如下:
1)安装 Nginx 服务;
2)安装 PHP-FPM 环境;
3)安装 MySQL/MariaDB 数据库;
4)安装 Zabbix Server、Agent、Frontend 服务;
5)配置 MySQL 用户,导入数据库表结构,并启动数据库服务;
6)配置 Zabbix Server 数据库连接,并启动服务以验证配置正确;
7)配置 PHP 环境参数,并启动 PHP-FPM 服务;
8)配置 Nginx 服务,绑定域名,指定目录,并启动服务;
9)配置 Frontend 以连接数据库,访问网页以查看;

CentOS 7.0 and Zabbix 4.0.1

Zabbix Documentation 4.0/1 Red Hat Enterprise Linux/CentOS

# 添加仓库,并安装 Server、Agent、Frontend(使用 MySQL 数据库)
rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
yum install -y zabbix-agent-4.0.1 zabbix-server-mysql-4.0.1 zabbix-web-mysql-4.0.1 \
    zabbix-get-4.0.1

# c. Create initial database
# Import initial schema and data. You will be prompted to enter your newly created password.
yum groups install 'MariaDB Database Client' 'MariaDB Database Server'
mysql_secure_installation

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;

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

# d. Configure the database for Zabbix server
# Edit file /etc/zabbix/zabbix_server.conf
DBPassword=password

# e. Configure PHP for Zabbix frontend
# Edit file /etc/httpd/conf.d/zabbix.conf, uncomment and set the right timezone for you.
php_value date.timezone Asis/Shanghai

# f. Start Zabbix server and agent processes
# Start Zabbix server and agent processes and make it start at system boot:
systemctl restart zabbix-server zabbix-agent httpd mariadb.service
systemctl enable zabbix-server zabbix-agent httpd mariadb.service

# Now your Zabbix server is up and running!

# g. Configure Zabbix frontend
# Connect to your newly installed Zabbix frontend: http://server_ip_or_name/zabbix
# Follow steps described in Zabbix documentation: \
# Installing frontend: https://www.zabbix.com/documentation/4.0/manual/installation/install#installing_frontend

# h. Start using Zabbix
# See Quickstart guide: https://www.zabbix.com/documentation/4.0/manual/quickstart/login

CentOS 7.4 and Zabbix Agent 4.2

#!/bin/sh

rpm -ivh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-2.el7.noarch.rpm
yum makecache
yum install -y zabbix-agent

CentOS 7.4 and Zabbix Agent 4.4.3

Zabbix Documentation 4.4/1 Red Hat Enterprise Linux/CentOS

#!/bin/sh

# 部署监控服务
rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
yum makecache
yum install -y zabbix-agent-4.4.3

# 修改配置文件

CentOS 6.5 and Zabbix Agent 4.4.3

Zabbix Documentation 4.4/1 Red Hat Enterprise Linux/CentOS

rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/6/x86_64/zabbix-release-4.4-1.el6.noarch.rpm
yum makecache
# yum info --showduplicate
yum install -y zabbix-agent-4.4.3

CentOS 6.5 and Zabbix 4.2

部署过程与 CentOS and Zabbix 完全类似,参照官方文档即可。

安装 Zabbix server 服务,详细参考「Download and install Zabbix」手册。

安装Zabbix agent服务:

#!/bin/sh

rpm -Uvh https://repo.zabbix.com/zabbix/4.2/rhel/6/x86_64/zabbix-release-4.2-2.el6.noarch.rpm
yum clean all

yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

chkconfig zabbix-agent on
service zabbix-agent start

参考文献

Home/Product/Download and install Zabbix