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

CentOS7 内网服务器yum修改

1、首先确定的内网服务器是有yum源代理服务器的

2、修改 /etc/yum.conf 配置文件,增加代理ip和端口号

     proxy=http://ip.ip.ip.ip:port

3、备份源是文件

sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

4、修改配置文件 vi CentOS-Base.repo,之后保存

# CentOS-Base.repo
# 替换为阿里云镜像源后的配置[base]
name=CentOS-7 - Base - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/7/os/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# 已禁用mirrorlist机制
# mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=$infra[updates]
name=CentOS-7 - Updates - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/7/updates/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# 已禁用mirrorlist机制
# mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=$infra[extras]
name=CentOS-7 - Extras - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/7/extras/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# 已禁用mirrorlist机制
# mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=$infra[centosplus]
name=CentOS-7 - Plus - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos/7/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# 已禁用mirrorlist机制
# mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=centosplus&infra=$infra

5、执行命令清理并重建缓存

sudo yum clean all
sudo yum makecache

6、验证配置

yum repolist

输出内容包含baseurl中的地址“mirrors.aliyun.com”,标识成功

http://www.lryc.cn/news/592618.html

相关文章:

  • 谈进程间通信
  • NVIDIA 驱动安装失败问题排查与解决(含离线 GCC 工具链安装全过程)
  • python爬虫获取PDF
  • 去中心化交易所(DEX)深度解析:解码行业头部项目
  • WEB安全架构
  • WEB弹性设计
  • MyBatis之关联查询
  • leetcode:冗余连接 II[并查集检查环][节点入度]
  • 【机器人】HOV-SG 开放词汇 | 分层3D场景图 | 语言引导机器人导航
  • vue3+vite 使用scss、sass 全局定义的变量以及使用
  • 【Linux】进程间通信(三)——共享内存和消息队列
  • 特种作业操作证(制冷空调)的考试科目有哪些?
  • Spring AI开发智能客服(Tool calling)
  • 第七章 愿景09 海波龙的坑
  • 链表算法之【链表的中间节点】
  • MSTP+VRRP+DHCP配置实验(ensp)
  • 医疗人工智能的心电图分析:创新技术与临床应用
  • 多组件Canvas ID冲突解决方案
  • Pythonday17
  • 深入理解进程地址空间:虚拟内存与进程独立性
  • 2-大语言模型—理论基础:详解Transformer架构的实现(2)
  • 专题 原型与继承完全指南
  • QT聊天项目DAY15
  • 更适合后端宝宝的前端三件套之HTML
  • GEV/POT/Markov/点过程/贝叶斯极值全解析;基于R语言的极值统计学
  • 设计模式五:桥模式(Bridge Pattern)
  • 关于在VScode中使用git的一些步骤常用命令及其常见问题:
  • Redis工具类
  • RHCE第二次作业
  • MyBatis:配置文件完成增删改查_添加