Zabbix 是一个基于 WEB 界面的提供分布式系统监视以及网络监视功能的企业级开源解决方案。它能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制,帮助系统管理员快速定位 / 解决问题。
- zabbix-server: 服务端
- zabbix-agent: 客户端
- zabbix-web: 网站服务
- php: 处理动态请求
- MySQL/PostgreSQL: 数据库存储数据
- Zabbix Proxy: 大规模分布式监控场景中分担 Zabbix Server 压力的分层结构,适用于跨机房、跨网络环境,可代替 Zabbix Server 收集性能和可用性数据并汇报给 Zabbix Server,减轻 Server 压力
systemctl stop firewalld.service
systemctl status firewalld.service
systemctl disable firewalld.service
编辑 SELinux 配置文件:
配置文件内容(修改后):

安装依赖:
yum install -y cmake make gcc zlib gcc-c++ perl readline readline-devel
yum install -y zlib-devel perl python36 tcl openssl ncurses-devel openldap pam
yum install -y zlib libicu
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
cat /etc/resolv.conf dnf update yum repolist all | grep pgdg
yum repolist enabled | grep pgdg
yum install -y postgresql14 postgresql14-server
rpm -aq| grep postgres echo "export PATH=/usr/pgsql-14/bin:$PATH" >> /etc/profile id postgres
/usr/pgsql-14/bin/postgresql-14-setup initdb systemctl enable postgresql-14
systemctl start postgresql-14
systemctl status postgresql-14
服务状态输出示例:

查看数据目录:
ll /var/lib/pgsql/14/data/ cd /var/lib/pgsql/14/data/ du -sh .
输出示例:

su - postgres psql postgres=
输出示例:

postgres= postgres= postgres=
cat >> /var/lib/pgsql/14/data/postgresql.conf <<"EOF"
listen_addresses = '*'
port=5432
logging_collector = on
log_directory = 'pg_log'
log_filename = 'postgresql-%a.log'
log_truncate_on_rotation = on
EOF
cat << EOF >> /var/lib/pgsql/14/data/pg_hba.conf # TYPE DATABASE USER ADDRESS METHOD
local all all trust
host all all 127.0.0.1/32 trust
host all all 0.0.0.0/0 md5
host replication all 0.0.0.0/0 md5
local replication all trust
EOF
systemctl restart postgresql-14 systemctl status postgresql-14
远程登陆 psql -U postgres -h 192.168.3.11 -d postgres -p 5432
rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-4.el8.noarch.rpm yum clean all
dnf install zabbix-server-pgsql zabbix-web-pgsql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
查看已安装组件:

echo "postgres ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers su - postgres sudo -u postgres createuser --pwprompt zabbix sudo -u postgres createdb -O zabbix zabbix ALTER USER zabbix WITH PASSWORD 'password'; zcat /usr/share/zabbix-sql-scripts/postgresql/server.sql.gz | sudo -u zabbix psql zabbix select count(tablename) from pg_tables where schemaname='public';
vi /etc/zabbix/zabbix_server.conf DBPassword=password LogFile=/var/log/zabbixsrv/zabbix_server.log DBHost=192.168.3.11 DBName=zabbix DBUser=zabbix DBPort=5432 sed -ri.bak '/# DBPassword=/cDBPassword=password' /etc/zabbix/zabbix_server.conf
vi /etc/nginx/conf.d/zabbix.conf listen 80; server_name localhost;
vi /etc/php.ini post_max_size = 16M max_execution_time = 300 max_input_time = 300
rm -rf /usr/share/nginx/html/* cp -r /usr/share/zabbix/ /usr/share/nginx/html/
systemctl restart zabbix-server zabbix-agent nginx php-fpm systemctl enable zabbix-server zabbix-agent nginx php-fpm
错误现象:
[root@rhel8 ~] zabbix_server: /usr/pgsql-14/lib/libpq.so.5: no version information available (required by zabbix_server) zabbix_server: symbol lookup error: zabbix_server: undefined symbol: usmAES192PrivProtocol
错误原因:系统镜像中的 net-snmp-libs-5.8.10 安装包不支持 usmAES192 privacy protocol,导致 zabbix-server 启动失败。
解决步骤:
rpm -qa | grep -i net-snmp ldd /usr/sbin/zabbix_server | grep -i snmp
nm -D /lib64/libnetsnmp.so.35 | grep -i aes wget http://repo.okay.com.mx/centos/8/x86_64/release/net-snmp-libs-5.8-12.el8.x86_64.rpm rpm -ivh net-snmp-libs-5.8-12.el8.x86_64.rpm dnf install net-snmp-libs
验证启动成功:

安装zh_CN语言包
dnf install langpacks-zh_CN.noarch
安装glibc-common实现对语言包的识别
dnf -y install glibc-common
验证语言包:

重启相关服务:
systemctl restart zabbix-server zabbix-agent nginx php-fpm
浏览器输入地址:http://zabbix-ServerIP/zabbix(示例:http://192.168.3.11/zabbix/setup.php)

- 欢迎页面:选择默认语言为 “中文 (zh_CN)”,点击 “下一步”。
- 必要条件检测:确认所有依赖项满足,点击 “下一步”。
- 配置 DB 连接:
- 数据库类型:PostgreSQL
- 数据库主机:192.168.3.11(替换为实际数据库 IP,避免localhost可能出现的连接问题)
- 数据库端口:5432(默认端口,非 0)
- 数据库名称:zabbix
- 数据库用户:zabbix
- 数据库密码:输入之前设置的 zabbix 用户密码
- 数据库 TLS 加密:根据需求选择(示例为 true)
- 点击 “下一步”。
注意:若出现 “FATAL: no pg_hba.conf entry for host "::1", user "zabbix", database "zabbix"”,需确认 pg_hba.conf 配置并重启 PostgreSQL。

- Settings 配置:
- Zabbix 主机名称:zabbix6(自定义)
- 默认时区:(UTC+05:00) Asia/Ashgabat(根据实际时区调整)
- 默认主题:蓝(默认)
- 点击 “下一步”。
- 安装前汇总:确认配置参数(数据库类型、服务器 IP、端口、名称、用户、密码等)无误,点击 “下一步”。
- 安装完成:提示 “配置文件 "/etc/zabbix/web/zabbix.conf.php" 已创建”,点击 “完成”。
默认用户名:Admin
默认密码:zabbix
登录页面:http://192.168.3.11:80/zabbix(示例)
登录页面示例:
ZABBIX
用户名称:Admin
密码:□
30天内记住我
登录 帮助 ·支持
cd /usr/share/nginx/html/zabbix/assets/fonts cp /opt/simkai.ttf ./ [root@rhe18 fonts] total 11512 lrwxrwxrwx. 1 root root 33 Feb 5 09:47 graphfont.ttf -> /etc/alternatives/zabbix-web-font
-rw-r--r--. 1 root root 11787328 Feb 5 10:50 simkai.ttf [root@rhe18 fonts] sed -i 's/graphfont/simkai/g' /usr/share/nginx/html/zabbix/include/defines.inc.php
tail -f /var/log/zabbix/zabbix_server.log Zabbix WEB配置文件:/etc/zabbix/web/zabbix.conf.php
登录后 Zabbix 监控页面示例(部分信息):
- 系统信息:Zabbix 服务器端运行中(localhost:10051)、主机数量(1,1/0 启用 / 禁用)、模板数量(353)、监控项数量(99,91/0/8 启用 / 禁用 / 不支持)、触发器数量(56,56/0 启用 / 禁用 [0/56 问题 / 正常])、在线用户数(2)等。

- 监控图表:Linux CPU utilization(平均 3.3314%)、Zabbix server 内存使用(总内存 3.67GB,可用内存 2.45GB)等。
