Skip to content

Commit a7aca95

Browse files
Auto-update blog content
1 parent 38ffdea commit a7aca95

File tree

69 files changed

+24925
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+24925
-0
lines changed
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
---
2+
layout: post
3+
title: "CentOS-8-部署-Zabbix-7.0-LTS-完整流程PostgreSQL及不同系统agent安装"
4+
date: 2025-09-28T15:08:06+0800
5+
description: "CentOS 8 部署 Zabbix 7.0 LTS 完整流程(PostgreSQL)及不同系统agent安装"
6+
keywords: "centos8 zabbix"
7+
categories: ['未分类']
8+
tags: ['Zabbix', 'Postgresql', 'Centos']
9+
artid: "152218191"
10+
arturl: "https://blog.csdn.net/qq_44775960/article/details/152218191"
11+
image:
12+
path: https://api.vvhan.com/api/bing?rand=sj&artid=152218191
13+
alt: "CentOS-8-部署-Zabbix-7.0-LTS-完整流程PostgreSQL及不同系统agent安装"
14+
render_with_liquid: false
15+
featuredImage: https://bing.ee123.net/img/rand?artid=152218191
16+
featuredImagePreview: https://bing.ee123.net/img/rand?artid=152218191
17+
cover: https://bing.ee123.net/img/rand?artid=152218191
18+
image: https://bing.ee123.net/img/rand?artid=152218191
19+
img: https://bing.ee123.net/img/rand?artid=152218191
20+
---
21+
22+
23+
24+
# CentOS 8 部署 Zabbix 7.0 LTS 完整流程(PostgreSQL)及不同系统agent安装
25+
26+
CentOS 8 部署 Zabbix 7.0 LTS 完整流程(PostgreSQL)
27+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/006c367c75d142a4b8fd686fc269f946.png)
28+
29+
所需要的安装centos8的一切基础配置,我这里配置的比较大,因为需要监控的服务器比较多,这里可以根据实际环境来配置
30+
一、基础环境准备
31+
1、关闭防火墙(按需,生产建议仅放行端口)
32+
systemctl stop firewalld
33+
systemctl disable firewalld# firewall-cmd --permanent --zone=public --add-port=80/tcp# firewall-cmd --reload
34+
2、关闭 SELinux
35+
getenforce
36+
vi /etc/sysconfig/selinux# 修改为
37+
SELINUX=disabled
38+
reboot
39+
3、更新系统
40+
yum update -y
41+
二、安装 Zabbix 源 & PHP8.0
42+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/494a7fd5cf6140c6852179dd2733b7da.png)
43+
44+
1、添加 Zabbix 源
45+
rpm -Uvh https://repo.zabbix.com/zabbix/7.0/centos/8/x86_64/zabbix-release-latest-7.0.el8.noarch.rpm
46+
dnf clean all
47+
dnf makecache
48+
2、切换 PHP 版本为 8.0(zabbix7.0lts默认是需要配置php:8.0,但是centos7默认已经不支持php:8.0了)
49+
dnf module reset php -y
50+
dnf module enable php:8.0 -y
51+
52+
```
53+
可能会出现错误安装失败,可以安装下面方法安装,必须确认为PHP8.0才继续安装下面zabbix步骤,以免出错。
54+
一、前置准备,确保系统是最新,并安装常用工具:
55+
sudo dnf update -y
56+
sudo dnf install -y wget curl vim tar unzip yum-utils
57+
二、启用 EPEL & Remi 源
58+
注意:Remi 仓库的新版本(>= 8.10)可能会报错,你的 CentOS 8 已经停止更新(EOL),所以推荐用 vault.centos.org 或者 指定旧版本的 Remi 源。
59+
方案 A:使用官方 Vault(推荐,稳定)
60+
sudo sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/CentOS-*.repo
61+
sudo dnf clean all
62+
安装 EPEL:
63+
sudo dnf install -y epel-release
64+
安装 Remi 源(用 8.5 版本,兼容 CentOS 8.4/8.5 系统):
65+
sudo dnf install -y http://rpms.remirepo.net/enterprise/remi-release-8.5-3.el8.remi.noarch.rpm
66+
方案 B:强制使用最新 Remi(可能触发依赖错误)
67+
如果你必须用最新版本,可以加 --nobest 跳过依赖检查:
68+
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y --nobest
69+
三、安装 PHP 8.0
70+
重置并启用 Remi 提供的 PHP 模块:
71+
sudo dnf module reset php -y
72+
sudo dnf module enable php:remi-8.0 -y
73+
安装 PHP 8.0 及常用扩展:
74+
sudo dnf install -y php php-fpm php-mysqlnd php-xml php-curl php-gd php-mbstring php-opcache php-zip php-json php-bcmath
75+
启动并设置开机自启:
76+
sudo systemctl enable --now php-fpm
77+
四、验证安装
78+
php -v
79+
80+
```
81+
82+
三、安装 Zabbix Server、Web 前端、Agent
83+
dnf install -y zabbix-server-pgsql zabbix-web-pgsql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
84+
四、安装 PostgreSQL 数据库
85+
86+
1、安装 PostgreSQL 官方源
87+
dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
88+
dnf -qy module disable postgresql
89+
2、安装 PostgreSQL 16
90+
dnf install -y postgresql16-server
91+
3、初始化并启动数据库
92+
/usr/pgsql-16/bin/postgresql-16-setup initdb
93+
systemctl enable postgresql-16
94+
systemctl start postgresql-16
95+
五、配置数据库
96+
1、创建数据库用户和数据库
97+
sudo -u postgres createuser --pwprompt zabbix
98+
sudo -u postgres createdb -O zabbix zabbix
99+
2、导入 Zabbix 初始数据库
100+
zcat /usr/share/zabbix-sql-scripts/postgresql/server.sql.gz |
101+
sudo -u zabbix psql zabbix
102+
六、配置 Zabbix Server
103+
1、编辑 /etc/zabbix/zabbix_server.conf:
104+
DBName=zabbix
105+
DBUser=zabbix
106+
DBPassword=你的密码
107+
七、配置 Nginx + PHP
108+
1、编辑 /etc/nginx/conf.d/zabbix.conf,取消以下注释:
109+
listen 8080;
110+
server_name example.com;
111+
2、配置 PHP 时区 /etc/php-fpm.d/zabbix.conf:
112+
php_value[date.timezone] = Asia/Shanghai
113+
八、启动服务
114+
systemctl enable --now zabbix-server zabbix-agent nginx php-fpm postgresql-16
115+
浏览器访问:
116+
http://服务器IP:8080
117+
默认账户:
118+
用户名:Admin
119+
密码:zabbix
120+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/3a906dc3444b4da7b09e4a1d8d8af476.png)
121+
122+
九、中文语言支持
123+
安装中文语言包
124+
sudo sed -i ‘s/mirror.centos.org/vault.centos.org/g’ /etc/yum.repos.d/CentOS-*.repo
125+
sudo dnf install -y glibc-langpack-zh langpacks-zh_CN
126+
sudo localectl set-locale LANG=zh_CN.UTF-8
127+
查看语言包
128+
locale -a | grep zh_CNsource /etc/locale.conf
129+
重启 nginx
130+
systemctl restart nginx
131+
浏览器重新登录 Zabbix → 用户设置 → 语言选择 简体中文。
132+
十、安装win系统 agent
133+
134+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/7878007ce0504ca889b425ca37e46cae.png)
135+
136+
解压文件到桌面,必须以管理员权限运行Install-ZabbixAgent2.ps1,否则报错1625
137+
138+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/924ee414d6374facb6c3e7c1cce74d56.png)
139+
140+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/c70f8ff59a6443cda51f75c27a9d51d5.png)
141+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/b3b60d38792b4490bda4d208f573d8fa.png)
142+
143+
查看配置,已成功
144+
在server端配置,hostname为在agent端输入的IP地址
145+
146+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/2856dfb438384cb9ad508907c1d57f41.png)
147+
148+
稍等agent连接
149+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/d0a5465584444b5281bf14fb46d67fc7.png)
150+
151+
agent已上线
152+
十一、安装centos7系统 agent
153+
为了不破坏现有环境,采用rpm包安装,将zabbix-offline复制到/root/zabbix-offline目录下并添加执行权限
154+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/551ef04952b54f1885ec1fb34d6ec232.png)
155+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/5cb8401b35d1409ba710a1244dce642a.png)
156+
157+
跟着命令输入即可
158+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/11ef63938aa046f3876e5a802e64b68d.png)
159+
160+
确认hostname跟agent2状态正确
161+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/65f0a2d37ec0492f84334f0e61b204c3.png)
162+
163+
在server上添加主机
164+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/d3ac4fc9ded7489c870d0b6d75350f5e.png)
165+
166+
服务已上线
167+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/3b73251482664558b23d46258d97f452.png)
168+
169+
十二、安装centos8系统 agent
170+
安装不需要使用源码安装,直接使用dnf命令安装
171+
172+
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/1ae6b92a142143959cbaccc809623c6e.png)
173+
174+
175+

0 commit comments

Comments
 (0)