请从Zabbix官方网站或您的Linux发行版的软件仓库中获取适合您操作系统的软件包。安装过程可能因不同的Linux发行版而异,请遵循适用于您特定操作系统的官方指南进行操作。
在安装过程中,请注意配置Zabbix Server的数据库。您需要创建一个数据库,并为Zabbix Server指定正确的数据库连接参数。请确保数据库用户具有足够的权限,以便Zabbix Server能够读写数据库。
安装完成后,请启动Zabbix Server和Agent服务,并检查它们的状态以确保它们正在运行。您可以通过访问Zabbix Web界面来验证安装是否成功,通常可以通过在Web浏览器中输入http://<server_ip>/zabbix
来访问。
请记住,在首次访问Zabbix Web界面时,您需要设置管理员用户的密码。这是Zabbix安装过程中的一个关键步骤,确保您的密码强度足够,以保护您的监控数据。
最后,请配置Zabbix Server以适应您的监控需求。这可能包括添加主机、模板和触发器,以及调整警报和通知设置。请参考Zabbix官方文档,以获取有关如何配置Zabbix Server的详细信息。
Zabbix SIA 提供官方的 RPM 和 DEB 软件包,适用于:
针对各种操作系统发行版的 yum/dnf、apt 和 zypper 存储库的软件包文件可在 Zabbix official repository 中获取。
一些操作系统发行版(特别是基于 Debian 的发行版)提供了自己的 Zabbix 软件包。请注意,这些软件包 不 受 Zabbix 支持。第三方 Zabbix 软件包可能过时,并可能缺少最新功能和错误修复。建议仅使用 Zabbix official repository 中的软件包。如果您之前使用过非官方的 Zabbix 软件包,请参阅关于 upgrading the Zabbix packages from OS repositories 的说明。
The following notes apply to all systems:
DBHost=localhost
(or an IP address) in Zabbix server/proxy configuration makes PostgreSQL use a network socket instead of a local UNIX socket; see SELinux configuration for related setup instructions.The following notes apply to RHEL and its derivatives:
fping
are also available at the Zabbix Official Repository.iksemel
are also available at the Zabbix Official Repository.libssh2
are also available at the Zabbix Official Repository.Zabbix uses socket-based inter-process communication. On systems where Security-Enhanced Linux (SELinux) is enabled, you may need to add SELinux rules to allow Zabbix create/use UNIX domain sockets in the SocketDir directory. Socket files are used by Zabbix server (alerter, preprocessing, IPMI) and Zabbix proxy (IPMI), and they're present while the process is running.
Having SELinux enabled in enforcing mode, execute the following commands to enable communication between Zabbix frontend and server:
For RHEL 7 (and later), AlmaLinux, CentOS Stream, Oracle Linux, Rocky Linux 8 (and later):
If the database is accessed over the network (including localhost
for PostgreSQL), also allow Zabbix frontend to connect to the database:
For RHEL prior to 7:
After applying SELinux settings, restart Apache:
Optionally, you can install a pre-defined zabbix-selinux-policy
package from The Zabbix Official Repository. This package is provided for all supported OS versions to simplify Zabbix deployment and prevent users from turning off SELinux because of the configuration complexity.
For maximum security, it is recommended to set custom SELinux settings.
The zabbix-selinux-policy
package contains a basic SELinux policy, allowing Zabbix to create and use sockets and enabling HTTPd connection to PostgreSQL (used by frontend).
The source zabbix_policy.te
file contains the following rules:
module zabbix_policy 1.2;
require {
type zabbix_t;
type zabbix_port_t;
type zabbix_var_run_t;
type postgresql_port_t;
type httpd_t;
class tcp_socket name_connect;
class sock_file { create unlink };
class unix_stream_socket connectto;
}
#============= zabbix_t ==============
allow zabbix_t self:unix_stream_socket connectto;
allow zabbix_t zabbix_port_t:tcp_socket name_connect;
allow zabbix_t zabbix_var_run_t:sock_file create;
allow zabbix_t zabbix_var_run_t:sock_file unlink;
allow httpd_t zabbix_port_t:tcp_socket name_connect;
#============= httpd_t ==============
allow httpd_t postgresql_port_t:tcp_socket name_connect;
Debuginfo packages contain debugging symbols for Zabbix binaries. They are not required for normal installation or operation but are useful for advanced troubleshooting.
To enable the zabbix-debuginfo
repository:
/etc/yum.repos.d/zabbix.repo
and set enabled=1
for the zabbix-debuginfo
section:[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=http://repo.zabbix.com/zabbix/7.0/stable/rhel/7/$basearch/debuginfo/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=1
/etc/zypp/repos.d/zabbix.repo
and set enabled=1
for the zabbix-debuginfo
section:[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo
type=rpm-md
baseurl=https://repo.zabbix.com/zabbix/7.0/stable/sles/15/x86_64/debuginfo/
gpgcheck=1
gpgkey=https://repo.zabbix.com/zabbix/7.0/stable/sles/15/x86_64/debuginfo/repodata/repomd.xml.key
enabled=0
update=1
Once enabled, install the packages: