Rocky9

news/2024/11/17 3:35:45/文章来源:https://www.cnblogs.com/Rohing/p/18406916

Rocky Linux 9.4 部署Zabbix 7.0

1-1.检测源

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm #下载epel的源
rpm -ivh epel-release-latest-8.noarch.rpm #epel安装
rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rocky/9/x86_64/zabbix-release-7.0-2.el9.noarch.rpm && yum clean all # 安装zabbix源

1-2.替换源

[root@localhost yum.repos.d]# cat /etc/yum.repos.d/zabbix.repo  #看到连接的是官方镜像仓库,有可能因为我们网络不给力可能会下载不了,所以我们更改为阿里云的镜像仓库
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/7.0/rocky/9/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-B5333005[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/9/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-08EFA7DD
gpgcheck=1[zabbix-sources]
name=Zabbix Official Repository source code - $basearch
baseurl=https://repo.zabbix.com/zabbix/7.0/rocky/9/SRPMS
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-B5333005
gpgcheck=1

2-1.安装Zabbix Server、Web前端、Agent

yum install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent -y

2-2.创建初始数据库

yum install -y mariadb  mariadb-server #安装数据库
systemctl enable mariadb --now  #启动数据库
[root@zabbix-server ~]# mysql_secure_installation # 初始化脚本NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDBSERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.Enter current password for root (enter for none):  # 按回车设置或更改root用户的密码
OK, successfully used password, moving on...Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.You already have your root account protected, so you can safely answer 'n'.Switch to unix_socket authentication [Y/n] y  # 切换到unix_socket身份验证
Enabled successfully!
Reloading privilege tables..... Success!You already have your root account protected, so you can safely answer 'n'.Change the root password? [Y/n] y # 更改root密码
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..... Success!By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.Remove anonymous users? [Y/n] y # 删除匿名用户... Success!Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] n  # 限制root远程登录... skipping.By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.Remove test database and access to it? [Y/n] y # 删除测试数据库和访问权限- Dropping test database...... Success!- Removing privileges on test database...... Success!Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.Reload privilege tables now? [Y/n] y  # 重新加载权限表... Success!Cleaning up...All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.Thanks for using MariaDB!

2-3.插入数据

# 登陆数据库
mysql -uroot -p
# 创建名为zabbix的数据库,并设置字符集为utf8mb4,排序规则为utf8mb4_bin
create database zabbix character set utf8mb4 collate utf8mb4_bin;
# 创建名为zabbix的用户,并设置其密码为'000000'
create user zabbix@localhost identified by '000000';
# 授予zabbix用户在zabbix数据库上的所有权限
grant all privileges on zabbix.* to zabbix@localhost;
# 设置全局变量log_bin_trust_function_creators为1
set global log_bin_trust_function_creators = 1;
# 退出MariaDB
quit;

2-4.导入数据库

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
需要输入密码:123456(我设置的)

2-5.导入数据库架构后禁用log_bin_trust_function_creators选项

# 登陆mysql
mysql -uroot -p
# 设置全局变量log_bin_trust_function_creators为0
set global log_bin_trust_function_creators = 0;
# 退出MariaDB
quit;

2-6.Zabbix server配置数据库

编辑配置文件 /etc/zabbix/zabbix_server.conf (改成自己设置的密码)

image-20240903121314515

2-7.为Zabbix前端配置PHP

编辑配置文件 /etc/nginx/conf.d/zabbix.conf 取消注释并设置“listen”和“server_name”指令。

image-20240903121426735

2-8.放行端口(一开始也可以放行)

放行80(nginx),8080(zabbix自定义端口),10050(agent端口),3306(数据库端口)

firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --add-port=10050/tcp --permanent
firewall-cmd --add-port=8080/tcp --permanent
firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --reload
curl http://192.168.61.17:8080/ #curl请求一下是否正常
浏览器访问:http://本机IP:8080/setup.php #login:Admin passwd:zabbix

image-20240903121637976

3-1.配置zabbix

image-20240903121733382

image-20240903121740468

image-20240903121748777

image-20240903121758886

image-20240903121808432

image-20240903121818586

image-20240903121829466

企业微信截图_17253358825590

客户端安装

image-20240905164536750

rpm -Uvh https://repo.zabbix.com/zabbix/7.0/alma/9/x86_64/zabbix-release-7.0-5.el9.noarch.rpm && dnf clear all
#机器进行更换阿里云源
vim /etc/yum.repos.d/zabbix.repo 
# 修改完后的内容如下
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/7.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-B5333005[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=https://repo.zabbix.com/zabbix/7.0/rhel/7/$basearch/debuginfo/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-B5333005
gpgcheck=1[zabbix-sources]
name=Zabbix Official Repository source code - $basearch
baseurl=https://repo.zabbix.com/zabbix/7.0/rhel/7/SRPMS
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-B5333005
gpgcheck=1
vim /etc/zabbix/zabbix_agentd.conf 
# 修改如下内容
Server=zabbix-server IP        # 这里写Zabbix-server 节点的IP(被动监控)
ServerActive=zabbix-server IP  # 这里写Zabbix-server 节点的IP(主动监控)
Hostname=zabbix-agent          # 被监控的主机名
# 放行10050端口
firewall-cmd --add-port=10050/tcp --permanent
firewall-cmd --reload

添加主机

img

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/795072.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

洛谷题单指南-常见优化技巧-P1714 切蛋糕

原题链接:https://www.luogu.com.cn/problem/P1714 题意解读:求长度不超过m的最大子段和 解题思路: 1、暴力法 设a[N]表示原数组,s[N]是a[N]的前缀和,对于每一个元素s[i],计算其与前m个元素之差,取差值最大值,用代码表示: for(int i = 1; i <= n; i++) {for(int j …

【专题】2024年中国折叠屏手机市场与消费趋势研究报告合集PDF分享(附原数据表

原文链接:https://tecdat.cn/?p=37645 中国智能手机市场目前仍处于整体增长瓶颈期,增长复苏未达预期,消费者换机预期周期不断延长,使得行业对破局点的探寻更为紧迫。与此同时,中端消费者购机呈现出消费降级与升级的分化态势,不过更多人会选择体验更好、配置更优的产品以…

Goby 漏洞发布|(CVE-2024-45195)Apache OFBiz /viewdatafile 代码执行漏洞【已复现】

漏洞名称:Apache OFBiz /viewdatafile 代码执行漏洞(CVE-2024-45195) English Name:Apache OFBiz /viewdatafile Code Execution Vulnerability(CVE-2024-45195) CVSS core: 8.0 漏洞描述: Apache OFBiz是一个开源企业资源规划(ERP)系统。它提供了一套企业应用程序,…

navicat无法连接远程的mysql--Host ‘xx.xx.xx.xx‘ is not allowed to connect to this MySQL server“

之前在远程虚拟机上面部署了mysql,想在本地客户端使用navicat连接数据库,结果提示:host xxx is not allowed to connect to this mysql server解决 出现这个提示,是由于我们使用root用户登录时,没有给root用户设置能访问的机器,所以我们设置一下,就可以了。1:登录mysql…

jQuery中开发插件

页面代码<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><script s…

ubuntu 使用命令行查看硬件信息

ubuntu 使用命令行查看硬件信息 CPU cat /proc/cpuinfo其中,model name就显示了cpu的型号,cpu cores显示cpu的所有物理核心数量。 内存 cat /proc/meminfo其中,MemTotal就显示总内存大小,这里为32GB内存,SwapTotal显示了交换分区的内存大小,这里为 2GB。 硬盘大小 df -h可…

易百纳ss928开发板移植自训练模型跑通yolov5算法

ss928平台移植官方yolov5s算法参考文章:https://www.ebaina.com/articles/140000017418,这位大佬也开源了代码,gitee链接:https://gitee.com/apchy_ll/ss928_yolov5s 本文在参考上述文章的基础上,将官方yolov5s模型跑通,验证推理图片正确,然后移植自训练的推理模型,在移…

hyperworks软件许可优化解决方案

Hyperworks软件介绍 Altair 仿真驱动设计改变了产品开发,使工程师能够减少设计迭代和原型测试。提升科学计算能力扩大了应用分析的机会,使大型设计研究能够在限定的项目时间完成。现在,人工智能在工程领域的应用再次改变了产品开发。基于物理场的仿真驱动设计与机器学习相结…

Xcode 16 RC (16A242) 发布下载,正式版下周公布

Xcode 16 RC (16A242) 发布下载,正式版下周公布Xcode 16 RC (16A242) - Apple 平台 IDE IDE for iOS/iPadOS/macOS/watchOS/tvOS/visonOS 请访问原文链接:https://sysin.org/blog/apple-xcode-16/,查看最新版。原创作品,转载请保留出处。 作者主页:sysin.orgXcode 16 的新…

md5拓展攻击

md5拓展攻击 【工具】hash-ext-attack/img/img_1.png at master shellfeel/hash-ext-attack GitHub 【攻击方法例题】https://ctf.org.cn/2019/11/19/哈希长度扩展攻击以及HashPump安装使用和两道题目/ 实际中的利用条件如下:基于哈希的消息认证码 (MAC):长度扩展攻击的关键…

JAVA+VUE实现动态表单配置

功能描述: 资产管理系统中,在资产分类中,给同一种类型的资产配置定制化的表单项,并实现不同类型显示不同的数据,如图所示:数据库设计部分: 1.表单项表CREATE TABLE `dct_smp`.`t_asset_product_definitions` (`id` bigint NOT NULL,`product_id` bigint NOT NULL COMMEN…

vue 可选链操作符(?.)报错

一直用的好好的这个运算符,换了个项目,用不了了 首先交代一下,vue版本是2.6.11,node版本是v14.17.4 ,vue-template-compiler也是2.6.11 首先哈,我们升级一下vue到2.7.xx版本npm i vue@2.7.0 vue-template-compiler@2.7.0然后安装这个插件npm install @babel/plugin-propo…