本文記錄在Centos7.6平臺 經過yum安裝部署Zabbix 4.4php
Centos7.6 虛擬機一臺(ip: 192.168.152.140)前端
Mysql 8.0.12數據庫(ip: 192.168.152.1)mysql
yum安裝phplinux
# yum install -y php
yum安裝httpdweb
# yum install -y httpd
添加rpm包sql
# rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
安裝zabbix-server-mysqlshell
# yum install -y zabbix-server-mysql
安裝zabbix-web-mysql數據庫
# yum install -y zabbix-web-mysql
安裝zabbix-agentvim
# yum install -y zabbix-agent
mysql建立zabbix用戶,密碼爲zabbixcentos
CREATE USER 'zabbix'@'%' IDENTIFIED BY 'zabbix';
建立zabbix數據庫,併爲zabbix用戶賦予權限
CREATE DATABASE zabbix DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin; GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'%';
初始化schema
注: zabbix sql在下面的這個路徑
/usr/share/doc/zabbix-server-mysql-4.4.0/create.sql.gz
a. 若是zabbix主機安裝了mysql-client那麼能夠向mysql寫入初始化sql
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -h192.168.152.1 -uzabbix -p zabbix
b. 若是zabbix沒有安裝mysql-client,那麼則能夠將create.sql.gz文件導出,再執行sql,這裏就不在贅述
配置zabbix-server
# vim /etc/zabbix/zabbix_server.conf
能夠修改server相關配置,例如:端口,日誌,SSL,數據庫,告警腳本路徑等
這裏修改數據庫配置和容許的ip
DBHost=192.168.152.1 DBName=zabbix DBUser=zabbix DBPassword=zabbix DBPort=3306 StatsAllowedIP=0.0.0.0/0
配置zabbix前端
# vim /etc/httpd/conf.d/zabbix.conf
# 修改時區 php_value date.timezone Asia/Shanghai
SELinux 配置
# setsebool -P httpd_can_network_connect on # setsebool -P zabbix_can_network on # service httpd restart
zabbix-agent配置
# vim /etc/zabbix/zabbix_agentd.conf
# zabbix server地址 Server=192.168.152.140 ServerActive=192.168.152.140 Hostname=Zabbix-server
啓動zabbix-server和httpd
# systemctl restart zabbix-server httpd
啓動zabbix-agent
# systemctl start zabbix-agent
訪問 http://192.168.152.140/zabbix/
mysql zabbix 帳號問題,啓動zabbix-server時,出現了
9213:20191029:144309.734 [Z3001] connection to database 'zabbix' failed: [2059] Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
解決: 修改zabbix帳號
ALTER USER 'zabbix'@'%' IDENTIFIED WITH mysql_native_password BY 'zabbix';
未關閉selinux,出現
10947:20191029:145011.030 cannot start preprocessing service: Cannot bind socket to "/var/run/zabbix/zabbix_server_preprocessing.sock": [13] Permission denied.
解決:臨時關閉selinux
# setenforce 0