N1安装centos7无法换源问题已解决
1、备份(备份文件在当前路径下)
// 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup;
2、修改源地址
// 修改镜像地址
vi /etc/yum.repos.d/CentOS-Base.repo
3、修改后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-altarch/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-altarch/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-altarch/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
4、生成缓存
//清除缓存
yum clean all
//生成缓存
yum makecache
5、镜像地址更换失败原因分析
更换国内镜像源时地址出现错误或无法找到地址,比较CentOS-Base.repo发现原文件中地址中有/altarch/,直接下载的清华CentOS-Base.repo地址中无/altarch/,按图索骥在国内清华镜像站访问https://mirrors.tuna.tsinghua.edu.cn/centos-altarch,问题出在这里,赶紧复制链接替换掉,问题解决。