本文详细讲解如何在CentOS 9上部署Zabbix 7.0 Server,适合零基础读者,包含每一步命令和配置。关键词:Zabbix监控部署、CentOS 9教程、企业级监控系统、Zabbix 7.0安装。
确保CentOS 9最小化安装,并具有root权限。关闭防火墙和SELinux:
systemctl stop firewalldsystemctl disable firewalldsetenforce 0sed -i "s/^SELINUX=.*/SELINUX=disabled/" /etc/selinux/config
更新系统:
dnf -y update
添加Zabbix 7.0官方仓库:
rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rhel/9/x86_64/zabbix-release-7.0-1.el9.noarch.rpmdnf clean all
安装MariaDB服务器并启动:
dnf -y install mariadb-serversystemctl start mariadbsystemctl enable mariadb
进行安全设置(设置root密码等):
mysql_secure_installation
创建Zabbix数据库和用户:
mysql -uroot -pCREATE DATABASE zabbix CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;CREATE USER "zabbix"@"localhost" IDENTIFIED BY "your_password";GRANT ALL PRIVILEGES ON zabbix.* TO "zabbix"@"localhost";SET GLOBAL log_bin_trust_function_creators = 1;QUIT
安装Zabbix server、前端和agent:
dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
解压并导入数据:
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -p zabbix
输入之前设置的密码。导入后关闭log_bin_trust_function_creators:
mysql -uroot -p -e "SET GLOBAL log_bin_trust_function_creators = 0;"
编辑/etc/zabbix/zabbix_server.conf,设置数据库密码:
DBPassword=your_password
并取消注释DBHost=。
编辑/etc/php-fpm.d/zabbix.conf或/etc/php.ini,设置时区:
php_value[date.timezone] = Asia/Shanghai
或者在/etc/php.ini中设置date.timezone。
启动Zabbix server和agent,并设置开机自启:
systemctl restart zabbix-server zabbix-agent httpd php-fpmsystemctl enable zabbix-server zabbix-agent httpd php-fpm
浏览器访问http://服务器IP/zabbix,使用默认用户Admin密码zabbix登录。按照向导完成配置,注意数据库连接信息。
至此,Zabbix 7.0 Server部署完成。通过本教程,您已学会企业级监控系统的安装方法,更多配置请参考官方文档。
本文由主机测评网于2026-03-15发表在主机测评网_免费VPS_免费云服务器_免费独立服务器,如有疑问,请联系我们。
本文链接:http://www.vpshk.cn/20260331320.html