CentOS8.2同步阿里云Zabbix镜像到本地,本地搭建Zabbix仓库

  • A+
所属分类:linux技术
摘要

测试环境介绍

测试环境介绍

Yum源服务 Zabbix主机
主机名 yumserver zabbixserver
IP信息 192.168.6.178 192.168.6.159

第一步:安装依赖服务

dnf -y install  yum-utils createrepo 

第二步:下载阿里云镜像zabbix.repo文件

[root@ceph ceph]# cat /etc/yum.repos.d/zabbix.repo [zabbix] name=zabbix baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.2/rhel/8/x86_64/ gpgcheck=0 priority=1  [zabbix-source] name=zabbix-source baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.2/rhel/8/SRPMS/ gpgcheck=0 priority=1 

第三步:刷新缓存,元数据缓存建立

dnf clean all dnf makecache dnf repolist 

CentOS8.2同步阿里云Zabbix镜像到本地,本地搭建Zabbix仓库

第四步:同步镜像到本地

 [root@yumserver ceph]# mkdir -p /data/ceph/zabbix [root@yumserver ceph]# reposync -p /data/ceph/zabbix -n --repoid=zabbix zabbix                                                                 14 kB/s | 2.9 kB     00:00     (1/19): zabbix-apache-conf-5.2.2-1.el8.noarch.rpm                     105 kB/s |  18 kB     00:00     (2/19): zabbix-agent-5.2.2-1.el8.x86_64.rpm                           1.1 MB/s | 468 kB     00:00     (3/19): zabbix-agent2-5.2.2-1.el8.x86_64.rpm                           11 MB/s | 5.5 MB     00:00     (4/19): zabbix-get-5.2.2-1.el8.x86_64.rpm                             950 kB/s | 330 kB     00:00     (5/19): zabbix-nginx-conf-5.2.2-1.el8.noarch.rpm                      235 kB/s |  18 kB     00:00     (6/19): zabbix-js-5.2.2-1.el8.x86_64.rpm                              4.5 MB/s | 505 kB     00:00     (7/19): zabbix-java-gateway-5.2.2-1.el8.x86_64.rpm                    2.3 MB/s | 800 kB     00:00     (8/19): zabbix-proxy-mysql-5.2.2-1.el8.x86_64.rpm                     5.3 MB/s | 1.1 MB     00:00     (9/19): zabbix-proxy-pgsql-5.2.2-1.el8.x86_64.rpm                     3.5 MB/s | 1.1 MB     00:00     (10/19): zabbix-release-5.2-1.el8.noarch.rpm                           68 kB/s |  18 kB     00:00     (11/19): zabbix-sender-5.2.2-1.el8.x86_64.rpm                         2.1 MB/s | 364 kB     00:00     (12/19): zabbix-proxy-sqlite3-5.2.2-1.el8.x86_64.rpm                  2.8 MB/s | 1.0 MB     00:00     (13/19): zabbix-server-mysql-5.2.2-1.el8.x86_64.rpm                    12 MB/s | 2.8 MB     00:00     (14/19): zabbix-server-pgsql-5.2.2-1.el8.x86_64.rpm                    10 MB/s | 2.8 MB     00:00     (15/19): zabbix-web-deps-5.2.2-1.el8.noarch.rpm                       242 kB/s |  18 kB     00:00     (16/19): zabbix-web-5.2.2-1.el8.noarch.rpm                             10 MB/s | 3.3 MB     00:00     (17/19): zabbix-web-japanese-5.2.2-1.el8.noarch.rpm                   184 kB/s |  18 kB     00:00     (18/19): zabbix-web-mysql-5.2.2-1.el8.noarch.rpm                      156 kB/s |  17 kB     00:00     (19/19): zabbix-web-pgsql-5.2.2-1.el8.noarch.rpm                      259 kB/s |  17 kB     00:00     [root@yumserver ceph]# mkdir -p /data/ceph/zabbixsource [root@yumserver ceph]# reposync -p /data/ceph/zabbixsource -n --repoid=zabbix-source zabbix-source                                                         8.9 kB/s | 2.9 kB     00:00     (1/2): zabbix-release-5.2-1.el8.src.rpm                                78 kB/s |  19 kB     00:00     (2/2): zabbix-5.2.2-1.el8.src.rpm                                      22 MB/s |  19 MB     00:00     [root@yumserver ceph]#      

CentOS8.2同步阿里云Zabbix镜像到本地,本地搭建Zabbix仓库

第五步:创建YUM仓库

[root@yumserver zabbix]# pwd /data/ceph/zabbix/zabbix [root@yumserver zabbix]# createrepo -pdo /data/ceph/zabbix/zabbix /data/ceph/zabbix/zabbix Directory walk started Directory walk done - 19 packages Temporary output repo path: /data/ceph/zabbix/zabbix/.repodata/ Preparing sqlite DBs Pool started (with 5 workers) Pool finished     [root@yumserver zabbix-source]# createrepo -pdo  /data/ceph/zabbixsource/zabbix-source /data/ceph/zabbixsource/zabbix-source Directory walk started Directory walk done - 2 packages Temporary output repo path: /data/ceph/zabbixsource/zabbix-source/.repodata/ Preparing sqlite DBs Pool started (with 5 workers) Pool finished      

CentOS8.2同步阿里云Zabbix镜像到本地,本地搭建Zabbix仓库

CentOS8.2同步阿里云Zabbix镜像到本地,本地搭建Zabbix仓库

第六步:安装Nginx,搭建本地Web服务器

[root@yumserver /]#  dnf -y install nginx  在/etc/nginx/conf.d/下面创建repos.conf配置文件  [root@ceph ceph-source]# cat  /etc/nginx/conf.d/repos.conf server {     listen        80;     server_name   _;      # 404 错误页面重定向配置     error_page  404  /404.html;      # 50x 错误页面重定项配置     error_page   500 503 504  /50x.html;      error_log    /var/log/nginx/repos_error.log;     access_log   /var/log/nginx/repos_access.log;      root /data/ceph/;      location / {         autoindex on;     }      location = /50x.html {         root   /usr/share/nginx/html;     }      location = /404.html {         root   /usr/share/nginx/html;     } }   修改 /etc/nginx/nginx.conf 注释掉nginx默认的80端口服务: #    server { #        listen       80 default_server; #        listen       [::]:80 default_server; #        server_name  _; #        root         /usr/share/nginx/html;  #        root         /cephyum;          # Load configuration files for the default server block. #        include /etc/nginx/default.d/*.conf;  #        location / { #        }  #        error_page 404 /404.html; #            location = /40x.html { #        }  #        error_page 500 502 503 504 /50x.html; #            location = /50x.html { #        } #    }   重启nginx服务或让nginx重新加载配置 systemctl restart nginx.service #或 systemctl reload nginx.service 

第七步:修改Zabbix YUM仓库配置

登录到zabbix主机:192.168.6.159  [root@ceph ceph]# cat /etc/yum.repos.d/zabbix.repo [zabbix] name=zabbix baseurl=http://192.168.6.178/zabbix/zabbix/ gpgcheck=0 priority=1   [zabbix-source] name=zabbix-source baseurl=http://192.168.6.178/zabbixsource/zabbix-source/ gpgcheck=0 priority=1   #####################刷新缓存 dnf clean all dnf makecache dnf repolist  

CentOS8.2同步阿里云Zabbix镜像到本地,本地搭建Zabbix仓库

第八步:安装Zabbix Server部署

dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-agent 

CentOS8.2同步阿里云Zabbix镜像到本地,本地搭建Zabbix仓库