当前位置: 首页 > news >正文

Centos7.9同步外网yum源至内网

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum makecache
yum repolist

安装软件

yum install -y yum-utils createrepo		# yum-utils包含reposync同步工具,createrepo用于对rpm文件进行索引建立
reposync -n --repoid=extras --repoid=updates --repoid=base --repoid=epel -p /library/Centos7.9/		# -n 指下载最新软件包,-p 指定目录,--repoid 指定本地的源,如果不指定就同步所有源# 创建源索引
createrepo -po /library/Centos7.9/base/ /library/Centos7.9/base/
createrepo -po /library/Centos7.9/extras/ /library/Centos7.9/extras/
createrepo -po /library/Centos7.9/updates/ /library/Centos7.9/updates/
createrepo -po /library/Centos7.9/epel/ /library/Centos7.9/epel/
# 更新源索引
createrepo --update /library/Centos7.9/base/
createrepo --update /library/Centos7.9/extras/
createrepo --update /library/Centos7.9/updates/
createrepo --update /library/Centos7.9/epel/

创建yum源客repo配置文件

cat << EOF > /mirror/repo/CentOS-Base.repo[base]
name=CentOS- Base
baseurl=file:///library/Centos7.9/base/
enable=1
gpgcheck=0[updates]
name=CentOS- Updates
baseurl=file:///library/Centos7.9/updates/
enable=1
gpgcheck=0[extras]
name=CentOS- Extras
baseurl=file:///library/Centos7.9/extras/
enable=1
gpgcheck=0[epel]
name=CentOS- Epel
baseurl=file:///library/Centos7.9/epel/
enable=1
gpgcheck=0
EOF

相关文章:

  • 2025最新的软件测试面试大全(含答案+文档)
  • Java获取淘宝拍立淘API接口的详细指南
  • DeepSeek 大模型部署全指南:常见问题、优化策略与实战解决方案
  • 精益数据分析(64/126):移情阶段的用户触达策略——从社交平台到精准访谈
  • 开源项目实战学习之YOLO11:12.2 ultralytics-models-sam-decoders.py源码分析
  • 淘特入口无痕秒单怎么做的?
  • deepin v23.1 搜狗输入法next配置中文输入法下默认用英文标点
  • 如何在Cursor中高效使用MCP协议
  • [Java] 方法和数组
  • impala
  • 实验七 基于Python的数字图像水印算法
  • 【SpringBoot】MyBatisPlus(MP | 分页查询操作
  • CSP 2024 提高级第一轮(CSP-S 2024)单选题解析
  • Java异常、泛型与集合框架实战:从基础到应用
  • 用飞帆做一个网页,并假装是自己写的
  • C++跨平台开发:挑战与应对策略
  • 时间筛掉了不够坚定的东西
  • 基于C#的MQTT通信实战:从EMQX搭建到发布订阅全解析
  • 题单:递归求和
  • 复旦微FMQL调试笔记:PS网口
  • 四大皆空!赛季还没结束,曼城已经吃上“散伙饭”了
  • 柬埔寨果农:期待柬埔寨榴莲走进中国市场
  • 北京韩美林艺术馆党支部书记郭莹病逝,终年40岁
  • 新闻1+1丨强对流天气频繁组团来袭,该如何更好应对?
  • 福州一宋代古墓被指沦为露天厕所,仓山区博物馆:已设置围挡
  • 俄媒:俄乌代表团抵达谈判会场