替换默认源

替换源:

默认的源是国外的源,国外的源有可能打开比较慢有可能打不开所以要替换源。

国内很多厂商做了镜像我们现在使用163的源。

http://mirrors.163.com/.help/centos.html

1.首先备份repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2.查看到备份的repo

cd /etc/yum.repos.d/
ll              

3.安装CentOS 7 下载对应版本的 repo 放入到 /etc/yum.repos.d/CentOS-Base.repo

curl http://mirrors.163.com/.help/CentOS7-Base-163.repo -o CentOS7-Base-163.repo

4.运行下面命令生成缓存

yum clean all
yum makecache              

5.测试

yum -y update 

修改yum源为阿里

1. 备份本地yum源

 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak 

2.获取阿里yum源配置文件

配置文件地址:https://mirrors.tuna.tsinghua.edu.cn/help/centos/

将以下内容写入 /etc/yum.repos.d/CentOS-Base.repo

配置文件内容如下:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#[base]
name=CentOS-$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

3.更新cache

yum clean all
yum makecache 

4.测试

yum -y update 

linux centos7 替换yum源相关推荐

  1. 腾讯云服务器linux+CentOS7.9+yum源+nginx搭建网站

    第一次建网站 文章目录 前言 买服务器 配置服务器 使用xshell 连接 写一个html网页 创建文件夹 访问网站 安装nginx yum源配置 安装wegt 安装nginx 前言 参考B站程序员鱼 ...

  2. centos6 安装 mantisbt-1.2.8 —— (3)Linux系统下yum源配置(Centos 6)

    Linux系统下yum源的配置(阿里云): 1.备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.ba ...

  3. Centos7使用yum源安装mysql5.7和redis

    Centos7使用yum源安装mysql5.7 Centos7使用yum源安装redis windows安装mysql5.7 RPM是什么: RPM 是 LINUX 下的一种软件的可执行程序,你只要安 ...

  4. centos 7-aarch64如何替换yum源

    一.进入yum.repo.d [root@node-01 ~]# cd /etc/yum.repos.d/   [root@node-01 yum.repos.d]# ls CentOS-Base.r ...

  5. Centos7配置yum源(本地yum源和阿里网络yum源)

    一.centos7配置yum源 yum源分为本地yum源和网络yum源 1.配置本地yum源 步骤一:在centos虚拟机中挂载光盘 1.创建挂载点目录 [root@localhost ~]# mkd ...

  6. Linux 使用本地yum源及软件包管理

    Linux 使用本地yum源及软件包管理 2016-12-18 10:09 by 宋跃杰, 5 阅读, 0 评论, 收藏, 编辑 [root@node130 rh]# pwd /opt/rh [roo ...

  7. centos7中yum源安装mysql_centos7下使用yum安装mysql

    CentOS7的yum源中默认好像是没有mysql的.为了解决这个问题,我们要先下载mysql的repo源. 1. 下载mysql的repo源 $ wget http://repo.mysql.com ...

  8. 【问题解决方案】CentOS7替换yum的问题:使用yum makecache出现File contains no section headers

    [问题解决方案]CentOS7替换yum的问题:使用yum makecache出现File contains no section headers 参考文章: (1)[问题解决方案]CentOS7替换 ...

  9. Centos7更换yum源为阿里源

    Centos7更换yum源为阿里源 1.备份源 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backu ...

最新文章

  1. 『ES6』ES6 - 学习笔记
  2. 为什么说美团终将放弃打车?
  3. 集成测试还原数据库_项目学生:分片集成测试数据
  4. 5.3矩阵乘积(三元组存储结构)
  5. 为什么python安装不了numpy库_Python NumPy库安装使用笔记
  6. vmware中按Ctrl+Alt+Del的困扰
  7. STM32F429HAL库ADCDMA学习笔记
  8. 简易c语言编程软件,c语言开发工具下载
  9. 对于利用blender获取谷歌地图3D模型的补充
  10. 条码管理系统,帮助企业打造高效的仓库管理模式
  11. 计算机网络知识点全面总结,图文并茂,方便大家学习
  12. Java 开发之微信(支付宝)扫码支付的小总结
  13. win10升级后VMware不能使用,更新升级失败
  14. 层次低的人复杂,境界高的人简单,总结得真深刻!
  15. 每月生活费上万元,这届大学生花钱有多狠?
  16. 使用百度云加速服务进行配置网站https证书(例如:阿里云免费SSL证书)
  17. 常用的统计建模方法——差分分析
  18. Redis实现抢红包
  19. 中国酒庄行业经营状况及营销策略分析报告(新版)2022-2027年
  20. Windows的cmd命令提示符窗口命令大全

热门文章

  1. 安信可ESP-12F(ESP8266)介绍与使用
  2. 6.3 OpenSSH
  3. node.js之path模块的使用
  4. SanDisk闪迪推面向VMware Virtual SAN 6的增强型闪存
  5. 《嵌入式 Linux应用程序开发标准教程(第2版)》——1.1 嵌入式Linux基础
  6. 3月上旬中国域名解析服务商TOP10 DNSPOD升至8.24%
  7. 菜鸟学习计划浅谈之Linux系统
  8. Linux下部署开源版“禅道”项目管理系统
  9. 在组策略中通过.zap的形式发布软件!
  10. 汇编语言 实验10.1 显示字符串