[comment]: # translation:outdated

[comment]: # ({83c2fbfb-83c2fbfb})
# 1 Red Hat Enterprise Linux/CentOS

[comment]: # ({/83c2fbfb-83c2fbfb})

[comment]: # ({08efb81a-a324317c})
#### 概述

Zabbix官方包可用于: RHEL 8, CentOS 8 and Oracle Linux 8
[下载](https://www.zabbix.com/download?zabbix=5.0&os_distribution=red_hat_enterprise_linux&os_version=8&db=mysql)
RHEL 7, CentOS 7 and Oracle Linux 7
[下载](https://www.zabbix.com/download?zabbix=5.0&os_distribution=red_hat_enterprise_linux&os_version=7&db=mysql)

软件包可以使用MySQL/PostgreSQL数据库和Apache/Nginx webserver支持 [RHEL
6](https://repo.zabbix.com/zabbix/5.0/rhel/6/x86_64/)和[RHEL
5](https://repo.zabbix.com/zabbix/5.0/rhel/5/x86_64/)也可以使用Zabbix
agent包和实用程序Zabbix get和Zabbix sender

Zabbix官方存储库还提供fping，iksemel，libssh2软件包。
这些软件包位于[不支持的](https://repo.zabbix.com/non-supported/)目录中

[comment]: # ({/08efb81a-a324317c})

[comment]: # ({2cc8709e-9ccd42dd})
#### 安装注意事项

请参阅下载页面中每个平台的[安装说明](https://www.zabbix.com/download?zabbix=5.0&os_distribution=red_hat_enterprise_linux&os_version=8&db=mysql)，以了解：

-   安装存储库
-   安装server/agent/frontend
-   创建初始数据库，导入初始数据
-   为Zabbix server配置数据库
-   为Zabbix frontend配置PHP
-   启动server/agent进程
-   配置Zabbix frontend

如果要以root用户身份运行Zabbix
agent，请参阅[以root用户身份运行agent](https://www.zabbix.com/documentation/5.0/zh/manual/appendix/install/run_agent_as_root)

[comment]: # ({/2cc8709e-9ccd42dd})

[comment]: # ({b8d4355c-18eade42})
#### 使用TIMESCALE DB导入数据

使用TimescaleDB，除了PostgreSQL的import命令外，还运行：

    # zcat /usr/share/doc/zabbix-server-pgsql*/timescaledb.sql.gz | sudo -u zabbix psql zabbix

::: notewarning
仅Zabbix server支持TimescaleDB
:::

[comment]: # ({/b8d4355c-18eade42})

[comment]: # ({f14304eb-65152cbc})
#### frontend安装要求

Zabbix frontend需要基本安装中不提供的其他软件包。 您需要在将运行Zabbix
frontend的系统中启用可选rpm的存储库： RHEL 7:

    # yum-config-manager --enable rhel-7-server-optional-rpms

::: notetip
请注意，Nginx for RHEL在Red Hat Software
Collections和EPEL中可用。 如果使用Red Hat Software
Collections，只需安装zabbix-nginx-conf-scl软件包
:::

[comment]: # ({/f14304eb-65152cbc})

[comment]: # ({b7043904-fbd9106d})
#### SELINUX配置

在强制模式下启用SELinux状态后，您需要执行以下命令以启用Zabbix
frontend与server之间的通信： RHEL 7及更高版本：

    # setsebool -P httpd_can_connect_zabbix on

如果可以通过网络访问数据库（在PostgreSQL中包括“
localhost”），则还需要允许Zabbix frontend连接到数据库：

    # setsebool -P httpd_can_network_connect_db on

RHEL 7之前的版本：

    # setsebool -P httpd_can_network_connect on
    # setsebool -P zabbix_can_network on

完成frontend和SELinux配置后，重新启动Apache Web服务器：

    # service httpd restart

[comment]: # ({/b7043904-fbd9106d})

[comment]: # ({2f063110-084b0acc})
#### 代理安装

添加所需的存储库后，可以通过运行以下命令来安装Zabbix agent：

    # yum install zabbix-proxy-mysql

在命令中用“ pgsql”代替“ mysql”以使用PostgreSQL，或用“
sqlite3”代替以使用SQLite3（仅代理）

[comment]: # ({/2f063110-084b0acc})

[comment]: # ({1dfeed3d-24298233})
##### 创建数据库

为Zabbix
proxy[创建](/zh/manual/appendix/install/db_scripts)一个单独的数据库

Zabbix server和Zabbix proxy不能使用相同的数据库。
如果它们安装在同一主机上，则proxy数据库必须具有不同的名称

[comment]: # ({/1dfeed3d-24298233})

[comment]: # ({fe9e4d29-fe6abb8e})
##### 导入数据

导入初始架构：

    # zcat /usr/share/doc/zabbix-proxy-mysql*/schema.sql.gz | mysql -uzabbix -p zabbix

对于PostgreSQL（或SQLite）代理：

    # zcat /usr/share/doc/zabbix-proxy-pgsql*/schema.sql.gz | sudo -u zabbix psql zabbix
    # zcat /usr/share/doc/zabbix-proxy-sqlite3*/schema.sql.gz | sqlite3 zabbix.db

[comment]: # ({/fe9e4d29-fe6abb8e})

[comment]: # ({af6aea90-7b4b5122})
##### 为ZABBIX PROXY配置数据库

编辑zabbix\_proxy.conf：

    # vi /etc/zabbix/zabbix_server.conf
    DBHost=localhost
    DBName=zabbix
    DBUser=zabbix
    DBPassword=<password>

在DBName for Zabbix proxy中，请使用与Zabbix server不同的数据库
在DBPassword中，为MySQL使用Zabbix数据库密码；
PostgreSQL的PostgreSQL用户密码 在PostgreSQL中使用DBHost =。
您可能想要保留默认设置DBHost =
localhost（或IP地址），但这将使PostgreSQL使用网络套接字连接到Zabbix。
有关说明，请参见SELinux配置

[comment]: # ({/af6aea90-7b4b5122})

[comment]: # ({916abd47-c3b44766})
##### 启动ZABBIX PROXY过程

要启动Zabbix proxy进程并使其在系统启动时启动：

    # service zabbix-proxy start
    # systemctl enable zabbix-proxy

[comment]: # ({/916abd47-c3b44766})

[comment]: # ({eaf1ba9a-e4843785})
##### 前端配置

Zabbix proxy没有前端。 它仅与Zabbix server通信

[comment]: # ({/eaf1ba9a-e4843785})

[comment]: # ({dbc622b8-871a973b})
#### JAVA网关安装

仅当您要监视JMX应用程序时才需要安装[Java网关](/zh/manual/concepts/java)。
Java网关是轻量级的，不需要数据库
添加所需的存储库后，您可以通过运行以下命令来安装Zabbix Java网关：

    # yum install zabbix-java-gateway

继续进行[设置](/zh/manual/concepts/java/from_rhel_centos)，以获取有关配置和运行Java网关的更多详细信息

[comment]: # ({/dbc622b8-871a973b})

[comment]: # ({9223ffff-01c6084b})
#### 安装调试信息包

::: notetip
Debuginfo软件包当前可用于RHEL /
CentOS版本7、6和5
:::

要启用debuginfo存储库，请编辑/etc/yum.repos.d/zabbix.repo文件。
对于zabbix-debuginfo存储库，将enabled = 0更改为enabled = 1

    [zabbix-debuginfo]
    name=Zabbix Official Repository debuginfo - $basearch
    baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/debuginfo/
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
    gpgcheck=1

这将允许您安装zabbix-debuginfo软件包

    # yum install zabbix-debuginfo

该单个软件包包含所有Zabbix二进制组件的调试信息

[comment]: # ({/9223ffff-01c6084b})

[comment]: # ({dace1783-dace1783})
### Installing debuginfo packages

::: noteclassic
 Debuginfo packages are currently available for RHEL/CentOS
versions 7, 6 and 5. 
:::

To enable debuginfo repository edit */etc/yum.repos.d/zabbix.repo* file. Change `enabled=0` to `enabled=1`
for zabbix-debuginfo repository.

    [zabbix-debuginfo]
    name=Zabbix Official Repository debuginfo - $basearch
    baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/debuginfo/
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
    gpgcheck=1

This will allow you to install the zabbix-debuginfo package.

    # yum install zabbix-debuginfo

This single package contains debug information for all binary Zabbix
components.

[comment]: # ({/dace1783-dace1783})
