zabbix - [03] 安装部署

参考:https://www.yuque.com/fenghuo-tbnd9/ffmkvs

zabbix6要求操作系统为Centos8,所以一开始安装部署的时候发现少了zabbix-server-mysql、zabbix-web、zabbix-web-mysql

安装部署的版本为zabbix 4.x,具体版本可阅读对应的截图。

 

 

 

一、准备工作

1.1、服务器角色规划

主机名 IP地址 角色 备注
ctos79-01 192.168.2.121 zabbix-server 开启监控功能
ctos79-02 192.168.2.122 zabbix-agent  
ctos79-03 192.168.2.133 zabbix-agent  

1.2、关闭防火墙和SELinux

setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
systemctl stop firewalld.service

1.3、配置hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.2.121 ctos79-01
192.168.2.122 ctos79-02
192.168.2.123 ctos79-03

 

 

二、开始安装

2.1、配置zabbix的yum源

(1)访问阿里云镜像仓库:https://mirrors.aliyun.com,搜索zabbix

(2)下载Zabbix的yum源

# 安装wget命令
yum -y install wget
# 从阿里云下载zabbix的安装包
wget https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
# 或者直接安装
rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm


# -----------------下面两个不用管----------------
# 将zabbix的rpm包下载到本地,之后使用rpm -ivh xxx.rpm进行安装
wget http://repo.zabbix.com/zabbix/3.4/rhel/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
# 通过互联网获取并安装zabbix
rpm -ivh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm

 (3)安装Zabbix的yum源:rpm -ivh zabbix-release-6.5-1.el7.noarch.rpm,并查看zabbix的yum源

(4)将其他两台服务器也配置上zabbix的yum源

 

 

2.2、安装Zabbix

# 方法一:yum -y install epel-release.noarch
yum -y install zabbix-agent zabbix-get zabbix-sender zabbix-server-mysql zabbix-web zabbix-web-mysql

# 方法二
yum-config-manager --enable rhel-7-server-optional-rpms

 

2.3、安装设置数据库

服务器数量较多时,可部署到其他任一服务器;服务器数量较少时,可部署在Zabbix Server服务器上。

(1)创建mariadb.repo

cat > /etc/yum.repos.d/mariadb.repo << EOF
[mariadb]
name=MariaDB
baseurl=https://mirrors.ustc.edu.cn/mariadb/yum/10.4/centos7-amd64
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

(2)清理yum元数据缓存,重建元数据缓存:yum clean all && yum makecache fast

(3)安装mariadb:yum -y install MariaDB-server MariaDB-client

(4)修改配置文件:vim /etc/my.cnf.d/server.conf

[mysqld]
skip_name_resolve = ON          # 跳过主机名解析
innodb_file_per_table = ON      # 开启独立表空间
innodb_buffer_pool_size = 256M  # 缓存池大小
max_connections = 2000          # 最大连接数
log-bin = master-log            # 开启二进制日志

(5)重启数据库服务:systemctl restart mariadb

(6)初始化:mysql_secure_installation

(7)创建数据库并授权账号

-- Step1: 创建zabbix数据库
create database zabbix characcter set 'utf8';
-- Step2: 创建zbxuser用户,密码为keer,授权客户端IP网段为192.168.37.xxx
create user 'zbxuser'@'192.168.37.%' identified by 'keer';
-- Step3: 赋予zbxuser对数据库zabbix的所有权限
grant all an zabbix.* to 'zbxuser'@'192.168.37.%';
-- Step4: 刷新权限表
flush privileges;

我使用的是mysql

(8)查看zabbix-server-mysql这个包提供了什么

 

 

 

 

 

三、标题

 

 

 

— 业精于勤荒于嬉,行成于思毁于随 —

posted @ 2024-05-24 14:53  HOUHUILIN  阅读(31)  评论(0编辑  收藏  举报