redhat红帽官方软件仓库同步方案
说明:本方案为红帽官方镜像源同步方案,方案中以红帽7版本为案例(附带6跟8版本的方法以及脚本),每个rpms大概需要60G左右空间。其中同步的账号为红帽开发者账号,不涉及商业利益。
一:同步环境准备
1:redhat操作系统安装(6,7,8)
本文不具体赘述redhat系统安装方式,安装前规划好各级目录,同步所需空间以及带宽需求即可。
2:注册到红帽订阅系统(subscription-manager)
1):subscription-manager具体用法
2):注册绑定红帽账号:subscription-manager register
执行subscription-manager register会提示输入账号密码(账号密码不在此处提供),输入账号密码后系统提示绑定成功。
3)列出系统所有可用的订阅,并记录你在系统激活的订阅池Id。
执行subscription-manager list --available –all,列出系统所有可用的订阅,并记录订阅池ID。
4):使用订阅池id激活订阅。
执行subscription-manager attach --pool=Pool ID
5):关闭当前系统所有仓库
执行:subscription-manager repos --disable="*"
6):仅打开rhel-7-server-rpms仓库
执行subscription-manager repos --enable=rhel-7-server-rpms
7):列出当前系统开启的仓库。
执行:yum repolist,如果需要列出所有仓库包括被关闭的则执行yum repolist all。
8):测试下载软件包
执行yum install XXX
到这里同步环境已经准备好, 以上对repo仓库的操作为示例,只针对当前服务器有影响,后续同步软件包的过程,不会检查repo仓库是否关闭/开启,只要对应的配置(/etc/yum.repos.d/)存在,即可同步。
二:软件仓库同步
1:安装reporsync命令
执行:yum install yum-utils
RHEL 6/7 版本需要的reposync
命令需要单独安装rpm包: yum-utils
RHEL 8 版本则是集成在dnf
命令中
2:确认需要同步的各个rpms
本文以以下常见的几个仓库为例。
rhel-7-server-rpms
rhel-7-server-optional-rpms
rhel-7-server-extras-rpms
rhel-7-server-supplementary-rpms
rhel-ha-for-rhel-7-server-rpms
rhel-rs-for-rhel-7-server-rpms
rhel-7-server-debug-rpms
rhel-7-server-optional-debug-rpms
rhel-7-server-extras-debug-rpms
rhel-7-server-supplementary-debug-rpms
rhel-7-server-ansible-2-rpms
rhel-7-server-ansible-2-debug-rpms
rhel-ha-for-rhel-7-server-debug-rpms
rhel-rs-for-rhel-7-server-debug-rpms
3:编写同步所需脚本
此处提供6,7,8三个系统版本的同步脚本
#!/bin/bashdownload_path="/repos"reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-optional-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-extras-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-supplementary-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-ha-for-rhel-6-server-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-rs-for-rhel-6-server-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-debug-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-optional-debug-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-extras-debuginfo
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-6-server-supplementary-debuginfo
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-ha-for-rhel-6-server-debug-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-rs-for-rhel-6-server-debug-rpms
#!/bin/bash#定义下载回来的包存放的目录
download_path="/repos"cat << EOF > /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - \$basearch
baseurl=http://mirrors.aliyun.com/epel/7/\$basearch
failovermethod=priority
enabled=1
gpgcheck=0
EOFreposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-optional-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-extras-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-supplementary-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-ha-for-rhel-7-server-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-rs-for-rhel-7-server-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=epel
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-debug-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-optional-debug-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-extras-debug-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-supplementary-debug-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-ansible-2-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-7-server-ansible-2-debug-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-ha-for-rhel-7-server-debug-rpms
reposync --plugins --newest-only --delete --download_path=$download_path --repoid=rhel-rs-for-rhel-7-server-debug-rpms#--plugins 启用yum插件支持
#--newest-only 每次回购仅下载最新的软件包。
#--download_path 软件包存放地址
#--repoid 需要下载的仓库ID
#!/bin/bashdownload_path="/repos"cat << EOF > /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux \$releasever - \$basearch
baseurl=https://mirrors.aliyun.com/epel/\$releasever/Everything/\$basearch
enabled=1
gpgcheck=0
[epel-modular]
name=Extra Packages for Enterprise Linux Modular \$releasever - \$basearch
baseurl=https://mirrors.aliyun.com/epel/\$releasever/Modular/\$basearch
enabled=1
gpgcheck=0
EOFdnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=rhel-8-for-x86_64-appstream-rpms
dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=rhel-8-for-x86_64-baseos-rpms
dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=rhel-8-for-x86_64-highavailability-rpms
dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=rhel-8-for-x86_64-resilientstorage-rpms
dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=rhel-8-for-x86_64-appstream-debug-rpms
dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=rhel-8-for-x86_64-baseos-debug-rpms
dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=epel
dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=epel-modular
dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=codeready-builder-for-rhel-8-x86_64-rpms
dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=ansible-2-for-rhel-8-x86_64-rpms
dnf reposync --newest-only --delete --download-path=$download_path --download-metadata --repoid=ansible-2-for-rhel-8-x86_64-debug-rpms
4:执行脚本同步
1):执行sh 7_repo_update.sh
转存失败重新上传取消
2)查看发现包正在陆续下载回来
转存失败重新上传取消
至此红帽仓库开始同步,等待同步完成即可。以上提供的脚本可加入定时任务定时增量同步。
redhat红帽官方软件仓库同步方案相关推荐
- redhat7配置yum repos软件仓库远程yum
redhat7配置yum repos软件仓库&远程yum Red Hat Enterprise Linux 7 安装后,执行yum命令是提示无可用yum repos(There are no ...
- CentOS官方推荐的RPMforge软件仓库安装方法[linux]
RPMForge拥有4000多种CentOS的软件包,被CentOS社区认为是最安全也是最稳定的一个软件仓库. 主页:http://rpmforge.net/ 1.确认系统是否安装了priority这 ...
- Ubuntu软件仓库源类型:官方源、第三方源、本地源
APT (Advanced Packaging Tool) 用于管理Ubuntu及其衍生版本的软件包.APT依赖于存储在Ubuntu软件仓库中的软件包.Ubuntu软件仓库源是APT用于获取软件包的位 ...
- RPM(红帽软件包管理器)和Yum软件仓库
1.红帽软件包管理器 RPM机制是为了解决在校效.安装.卸载.查询.升级等管理软件操作过难设计的. 常用RPM软件包命令: 1)安装软件命令格式:rpm -ivh filename.rpm 2)升级软 ...
- Linux-什么是二进制包,源码包,RPM包,软件仓库
博文说明[前言]: 本文将通过个人口吻介绍什么是二进制包,RPM包,源码RPM包(SRPM包),源码包,以及RPM常用命令,源码rpm的安装(*.src.rpm),源码包的安装步骤知识(./confi ...
- Ubuntu/debian软件仓库源配置详解
今天配置Ubuntu软件源,看到一篇文章讲清楚了为什么需要配置软件源,特转载过来(http://baijiahao.baidu.com/s?id=1578857355620858850&wfr ...
- 程序的安装——软件安装包的制作、软件仓库的使用
读书笔记 -- <嵌入式C语言自我修养> 软件安装 linux 安装包的制作 编译 软件安装包路径 使用dpkg命令来制作安装包 及 安装包的卸载 软件仓库 更新源 查看具体需要更 ...
- RHCSA-A2.配置默认软件仓库
红帽RHCE考试上午-RHCSA(RH134) servera.example.com 任务 2.配置yum源 任务要求 yum的两个存储库的地址分别是: http://content.example ...
- 一种基于Visio替代软件的绘图方案
一种基于Visio替代软件的绘图方案 时间:2022年12月11日 作者:PEZHANG Visio是一款由微软公司开发的绘图软件,诚然,其功能非常强大,但仍有许多不足,一是学生在写论文时会高频使用, ...
- Google Calendar 跨平台同步方案(随时同步手机与电脑的日程安排)
Google Calendar跨平台同步方案 Google 随着搜索引擎的大获成功,不断推出很多受欢迎的服务产品,包括 Gmail,Calendar,Documents,Reader等等.其中的 Go ...
最新文章
- 麻省理工学院的牛人解说数学体系,你到哪个层次了?
- 安装Python2.7出现configure: error: no acceptable C compiler found in $PATH错误
- Thread如何中断
- NVIDIA各个领域芯片现阶段的性能和适应范围
- Win32ASM学习[2]:运算符
- mysql表数据提取工具,Jailer数据提取
- 2021年中国物流地产行业发展报告
- MyCat分布式数据库集群架构工作笔记0011---高可用_主从读写分离配置
- 常说的「缓存穿透」和「击穿」是什么
- 默认conf指向位置
- 【转】比较page、request、session、application的使用范围
- Android反编译与防止反编译
- 全网首发:麒麟平台更新时提示错误:无法解析域名“archive.kylinos.cn”
- 南宁出租车绿灯表示有客,红灯表示空车
- echarts实现半圆饼图
- excel白屏未响应_EXCEL2016经常卡死,白屏,经常使用过程中卡住,然后显示office正在尝试恢复...
- 2021年中国及各省市结婚登记人数、离婚登记人数、结婚率、离婚率、婚姻的正负面效应及政策建议分析[图]
- 11.9 至 11.17 四道典型题记录: Counter 弹出 | map函数 | 子集求取 | 有序字符桶分装
- Arduino RGB颜色渐变代码(附上C语言版本)
- Qt学习笔记(五):菜单栏