0x1 安装 zabbix包及各种必用软件和依赖
# rpm -Uvh https://repo.zabbix.com/zabbix/5.4/rhel/8/x86_64/zabbix-release-5.4-1.el8.noarch.rpm
# dnf clean all
# dnf install -y mysql.x86_64 mysql-devel.x86_64 mysql-common.x86_64 mysql-libs.x86_64 mysql-server.x86_64 mysql-errmsg.x86_64 zabbix-proxy-mysql.x86_64 zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-agent nginx tree net-tools wget curl php.x86_64 php-devel.x86_64 php-fpm.x86_64 php-mbstring.x86_64 php-mysqlnd.x86_64 php-opcache.x86_64 php-pecl-zip.x86_64 php-json.x86_64 langpacks-zh_CN
0x2 配置各个文件和参数
配置数据库
# systemctl start mysql
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;
导入数据库表
# zcat /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz | mysql -uzabbix -p zabbix
配置文件及数据密码
# vi /etc/zabbix/zabbix_server.conf
DBPassword=password
FpingLocation=/usr/sbin/fping
Fping6Location=/usr/sbin/fping6
授权fping和fping6 及配置文件
chown root:zabbix /usr/sbin/fping
chmod 6755 /usr/sbin/fping
chmod +s /usr/sbin/fping
chown root:zabbix /usr/sbin/fping6
chmod 6755 /usr/sbin/fping6
chmod +s /usr/sbin/fping6
修改nginx及PHP信息
Edit file /etc/nginx/conf.d/zabbix.conf and /etc/nginx/nginx.conf, uncomment and set 'listen' and 'server_name' directives.
# listen 80;
# server_name example.com;
root
关闭FW或修改FW配置
systemctl stop firewalld
或FW配置命令
firewall-cmd --zone=public --add-service=zabbix-server --permanent
firewall-cmd --zone=public --add-service=zabbix-agent --permanent
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --zone=public --add-service=https --permanent
firewall-cmd --zone=public --add-service=mysql --permanent
firewall-cmd --reload
关闭selinux
setenforce 0
或永久关闭 selinux
# vi /etc/selinux/config
SELINUX=disabled
0x3 重启各大服务PASS
# systemctl restart zabbix-server zabbix-agent nginx php-fpm
# systemctl enable zabbix-server zabbix-agent nginx php-fpm
更换中文字体
使用Windows中的字体替换graphfont.ttf
字体上传到/usr/share/zabbix/assets/fonts下面后,将雅黑字体MSYH.TTF改名为graphfont.ttf
0x4 浏览器中配置
zabbix数据库的用户名和密码要正确,配置中如果PHP自检没通过,请修改相应的 php配置文件 /etc/php.ini