Centos7使用wget修改为阿里云镜像源

1. 使用wget修改为阿里云镜像源

1.安装wget
yum install -y wget

2.完事前都做备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

如修改 /etc/yum.repos.d/CentOS-Base.repo

:%s/#baseurl/baseurl

3.下载阿里云镜像文件
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

4.清理缓存
yum clean all

5.生成缓存
yum makecache

6.更新最新源设置
yum update -y

其他:
如果要手动修改的话:
就vi 修改 CentOS-Base.repo 全局替换
baseurl=http://mirror.centos.org/centos/ r e l e a s e v e r / u p d a t e s / releasever/updates/ releasever/updates/basearch/
baseurl=http://mirrors.aliyun.com/centos/ r e l e a s e v e r / u p d a t e s / releasever/updates/ releasever/updates/basearch/
替换为阿里云的地址

2. 错误:Could not retrieve mirrorlist http://mirrorlist.centos.org/?

[root@localhost yum.repos.d]# yum -y install gcc
已加载插件:fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#7 - "Failed to connect to 2604:1580:fe02:2::10: 网络不可达"

修改 CentOS-Base.repo 中 mirrorlist 为 #mirrorlist, #baseurl 为 baseurl

[root@localhost yum.repos.d]# cat CentOS-Base.repo
……
……
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://10.153.3.130/centos/$releasever/os/$basearch/

参考:
https://blog.csdn.net/u014514528/article/details/101083047

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值