centos7开源镜像
1. 阿里云开源镜像站资源目录
https://mirrors.aliyun.com/centos/7/os/x86_64/
1、备份源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
3、非阿里云ECS用户会出现 Couldn't resolve host 'mirrors.cloud.aliyuncs.com' 信息,不影响使用,可以修改配置
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
4、生成缓存
yum makecache
5、查看当前源
yum repolist
2. 网易开源镜像站
http://mirrors.163.com/
wget http://mirrors.163.com/ .help/CentOS6-Base-163.repo
wget -O CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
1.进入/etc/yum.repos.d/目录
[root@localhost ~]
2.备份本地源
[root@localhost yum.repos.d]
3.下载网易源
[root@localhost yum.repos.d]
4.更新缓存
[root@localhost yum.repos.d]
3. 华为云
CentOS的镜像地址为:https://repo.huaweicloud.com/centos/
1、备份配置文件:
cp -a /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2、两种方案,请大家自行选取。
方案一:
下载新的CentOS-Base.repo文件到/etc/yum.repos.d/目录下,选择CentOS版本:
CentOS 7
执行如下命令:
wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
方案二:
修改CentOS-Base.repo文件,取消baseurl开头的行的注释,并增加mirrorlist开头的行的注释。将文件中的http://mirror.centos.org替换成https://repo.huaweicloud.com,可以参考如下命令:
sed -i "s/#baseurl/baseurl/g" /etc/yum.repos.d/CentOS-Base.repo
sed -i "s/mirrorlist=http/#mirrorlist=http/g" /etc/yum.repos.d/CentOS-Base.repo
sed -i "s@http://mirror.centos.org@https://repo.huaweicloud.com@g" /etc/yum.repos.d/CentOS-Base.repo
3、执行yum clean all清除原有yum缓存。
4、执行yum makecache(刷新缓存)或者yum repolist all(查看所有配置可以使用的文件,会自动刷新缓存)。