本環境使用epel源 rpm -iUvh http://mirrors.neusoft.edu.cn/epel//7/x86_64/e/epel-release-7-10.noarch.rpm
zabbix-server和zabbix-agent上在同一節點上
實驗ip為:172.16.169.128
關閉防火牆或用iptables寫入策略
1.安裝必須軟件包
yum -y install httpd mariadb mariadb-server php php-gd php-mysql php php-gd php-mysql php-bcmath php-mbstring
做apache和php的整合,修改apache的配置文件,默認首頁設置為php

增加php應用的支持

重啟httpd
2.配置zabbixzone package和GPG key

rpm -Uv http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm
3.安裝zabbix server
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway -y
編輯/etc/httpd/conf.d/zabbix.conf
更改時區:
添加上海時區

重啟httpd生效配置
開啟mariadb

然后設置mysql密碼

4.創建mariadb數據庫和用戶
create database zabbix character set utf8;
授權
grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
刷新權限
flush privileges;
5.數據庫導入zabbix template
查看需要導入的數據表

登錄zabbix數據庫
mysql -uzabbix -pzabbix
使用zabbix數據庫
use zabbix;
導入模板數據
source /usr/share/doc/zabbix-server-mysql-2.4.8/create/schema.sql
source /usr/share/doc/zabbix-server-mysql-2.4.8/create/images.sql
source /usr/share/doc/zabbix-server-mysql-2.4.8/create/data.sql
6.配置zabbix server
vi /etc/zabbix/zabbix_server.conf
開啟三個參數
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
7.配置zabbix-agent
vi /etc/zabbix/zabbix_agentd.conf
修改第85行添加zabbix-server的ip
Server=127.0.0.1 (因為是在同一節點上,所以ip寫本機回環即可)
修改第126行
ServerActive=127.0.0.1 (因為是在同一節點上,所以ip寫本機回環即可)
修改第137行
Hostname=127.0.0.1 (因為是在同一節點上,所以ip寫本機回環即可)
8.修改PHP配置
修改php.ini為zabbix建議的設置
編輯文件/etc/php.ini
設置下面的幾個參數
max_execution_time = 600
max_input_time = 600
memory_limit = 256
post_max_size = 32M
upload_max_filesize = 16M
date.timezone = Asia/Shanghai
9.修改Firewall和selinux設置
開放zabbix端口10050 和10051
firewall-cmd --permanent --add-port=10050/tcp
firewall-cmd --permanent --add-port=10051/tcp
重啟firewall(測試階段關閉防火牆)
systemctl restart firewalld
如果使用selinux,運行一下命令使apache可以和zabbix通信
啟動zabbix-server和zabbix-agent,重啟httpd,並設置開機自動啟動
systemctl start zabbix-server
systemctl start zabbix-agent
systemctl restart httpd
systemctl restart mariadb
systemctl enable zabbix-server
systemctl enable zabbix-server
11.通過控制台配置zabbix
http://172.16.169.128/zabbix/setup.php



點擊Test connection ,顯示ok在繼續



默認登錄賬號admin 密碼zabbix
