centos7.9安装zabbix
时间: 2023-07-12 07:04:39 浏览: 40
好的,以下是 CentOS 7.9 安装 Zabbix 的步骤:
1. 安装 EPEL 和 Zabbix 仓库
```shell
yum install -y epel-release
rpm -ivh https://repo.zabbix.com/zabbix/5.2/rhel/7/x86_64/zabbix-release-5.2-1.el7.noarch.rpm
```
2. 安装 Zabbix Server、Zabbix Agent 和 Zabbix Web
```shell
yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent
```
3. 安装 MySQL 数据库
```shell
yum install -y mariadb mariadb-server
```
4. 配置 MySQL 数据库
```shell
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
```
5. 创建 Zabbix 数据库
```shell
mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
quit;
```
6. 导入 Zabbix 数据库
```shell
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
```
7. 配置 Zabbix Server
编辑 `/etc/zabbix/zabbix_server.conf` 文件,修改以下参数:
```conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
```
8. 配置 Zabbix Web
编辑 `/etc/zabbix/web/zabbix.conf.php` 文件,修改以下参数:
```php
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = 'localhost';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'zabbix';
```
9. 启动 Zabbix Server 和 Zabbix Agent
```shell
systemctl start zabbix-server
systemctl start zabbix-agent
systemctl enable zabbix-server
systemctl enable zabbix-agent
```
10. 配置防火墙
```shell
firewall-cmd --add-port=10050/tcp --permanent
firewall-cmd --add-port=10051/tcp --permanent
firewall-cmd --reload
```
11. 访问 Zabbix Web
在浏览器中访问 `http://your_ip_address/zabbix`,输入默认用户名 `Admin` 和默认密码 `zabbix` 登录 Zabbix Web。
以上就是 CentOS 7.9 安装 Zabbix 的全部步骤。
相关推荐















