1、切换至 /etc/yum.repos.d
cd /etc/yum.repos.d
2、将此目录下的所有镜像文件均加上.bak 后缀
for file in *.repo; do
mv "$file" "${file}.bak"
done
注:${file%.repo} %后是删除的内容
3、在此路径下创建文件centos7.repo,输入以下内容
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-7
也可使用curl与wget命令替换原云(注:wget命令需下载)
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
也可直接去centos-vault安装包下载_开源镜像站-阿里云下载系统版本相对应得repo文件
查看系统版本命令
hostnamectl
4、使用清除缓存,重新建立缓存命令,即完成配置
yum clean all
yum makecache
5、实验-配置成功
yum install -y net-tools
标签:repo,mirrors,repos,centos7,yum,aliyun,com,搭建
From: https://blog.csdn.net/2303_77656826/article/details/144351121