CentOS7配置国内yum源与epel源

国内yum源

1.首先进入/etc/yum.repos.d/目录下,新建一个repo_bak目录,用于保存系统中原来的repo文件

[root@localhost ~]# cd /etc/yum.repos.d/

[root@localhost yum.repos.d]# mkdir repo_bak

[root@localhost yum.repos.d]# mv *.repo repo_bak/

2.在CentOS中配置使用网易和阿里的开源镜像

到网易和阿里开源镜像站点下载系统对应版本的repo文件


[root@localhost yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
--2020-12-29 18:54:19--  http://mirrors.aliyun.com/repo/Centos-7.repo
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 182.131.24.238, 182.131.24.242, 182.131.24.243, ...
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|182.131.24.238|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:2523 (2.5K) [application/octet-stream]
正在保存至: “Centos-7.repo”

100%[=============================================>] 2,523       --.-K/s 用时 0s      

2020-12-29 18:54:19 (309 MB/s) - 已保存 “Centos-7.repo” [2523/2523])




[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
--2020-12-29 18:55:59--  http://mirrors.163.com/.help/CentOS7-Base-163.repo
正在解析主机 mirrors.163.com (mirrors.163.com)... 123.53.139.70, 123.53.139.69, 123.53.139.71
正在连接 mirrors.163.com (mirrors.163.com)|123.53.139.70|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1572 (1.5K) [application/octet-stream]
正在保存至: “CentOS7-Base-163.repo”

100%[=============================================>] 1,572       --.-K/s 用时 0.01s   

2020-12-29 18:56:01 (126 KB/s) - 已保存 “CentOS7-Base-163.repo” [1572/1572])


查看下载

[root@localhost yum.repos.d]# ls
CentOS7-Base-163.repo  Centos-7.repo  repo_bak

[root@localhost yum.repos.d]# yum clean all               # 清除系统所有的yum缓存
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
正在清理软件源: base extras updates
Cleaning up list of fastest mirrors


[root@localhost yum.repos.d]# yum makecache           # 生成yum缓存
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repos
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值