首页 > 其他分享 >Rocky9

Rocky9

时间:2024-09-10 18:24:31浏览次数:1  
标签:-- root basearch Zabbix zabbix rpm Rocky9

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 MariaDB
      SERVERS 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

标签:--,root,basearch,Zabbix,zabbix,rpm,Rocky9
From: https://www.cnblogs.com/Rohing/p/18406916

相关文章

  • Rocky9.2安装docker-docker-compose
    1.更换阿里云源(可以不更换)sed-e's|^mirrorlist=|#mirrorlist=|g'-e's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux|g'-i.bak/etc/yum.repos.d/rocky-*.repodnfmakecache2.更新系统包sudo......
  • Rocky9怎么把网卡名由ens33修改为eth0
    环境查看```系统环境#cat/etc/redhat-releaseRockyLinuxrelease9.3(BlueOnyx)#uname-aLinuxRockyTemplete5.14.0-362.18.1.el9_3.0.1.x86_64#1SMPPREEMPT_DYNAMICSunFeb1113:49:23UTC2024x86_64x86_64x86_64GNU/Linux修改配置文件修改以下配......
  • conda 安装 (Rocky9 和 Ubuntu20.04)
    Conda官方网址:https://www.anaconda.com/Rocky9环境dnfupdate-ydnfinstallvimwgetlsofgccgcc-c++tarbzip2firewalldopenssl-develmlocatemakechronydocker-ybashAnaconda3-2024.02-1-Linux-x86_64.sh-p/opt/anaconda3vim/etc/profile文件末添加下面一行......
  • rocky9 编写一键安装mysql 的sh脚本
    基本操作步骤1、虚拟机最小化安装rocky9系统,安装后克隆一个系统;1个用来获取下载的rpm包,一个用来编写sh测试脚本;2、修改虚拟机的 yum配置文件,获取获取rpm程序 :启用缓存,并修改yum下载软件的路径;3、参考教程安装,安装mysql;Centos(rocky)yum安装mysql,切换路径、优化配置并......
  • Rocky9和CentOSStream9怎么设置固定IP地址
    Rocky9和CentOSStream9设置固定IP地址和CentOS不一样设置设置以下文件#cat/etc/NetworkManager/system-connections/ens3.nmconnection[connection]id=ens3uuid=322d81cf-5218-304d-b537-ddbb2a0eed07type=ethernetautoconnect-priority=-999interface-name=ens3times......
  • Rocky9 编译安装 Nginx Mariadb Asp.net Core6 (实测 笔记)
    引用 https://www.cnblogs.com/vicowong/p/16974219.html一、查看硬件信息1、查看物理cpu个数、核心数量、线程数grep'physicalid'/proc/cpuinfo|sort-u|wc-lgrep'coreid'/proc/cpuinfo|sort-u|wc-lgrep'processor'/proc/cpuinfo|sort-u|wc......
  • Rocky9 Mariadb_10.9.4 使用SSL实现主从同步
    一、预备操作#确保主从服务器时间同步#生成自签发证书(CA、主库证书、从库证书)#主库IP:192.168.0.10数据库版本:Mariadb_10.9.4需要证书:/data/ca/ca-cert.pem/data/ca......
  • Rocky9 下安装与配置 Fail2ban
    一、确认firewalld安装systemctlstartfirewalld&&systemctlenablefirewalldsystemctlstatusfirewalld查看firewalldfirewall-cmd--list-all二、安装fail2band......
  • Rocky9 在 VMware Workstation 17 Pro 上的安装
    本篇随笔仅记录Rocky9的安装。  镜像下载链接:https://rockylinux.org/download 我选择的版本如图: 我给的配置(本人笔记本CPU是8核16线程,内存32G,给的这个配置......
  • Rocky9 编译安装 Nginx Mariadb Asp.net Core6 (实测 笔记)
    一、查看硬件信息查看物理cpu个数、核心数量、线程数grep'physicalid'/proc/cpuinfo|sort-u|wc-lgrep'coreid'/proc/cpuinfo|sort-u|wc-lgrep'process......