一、进入yum.repo.d
[root@node-01 ~]# cd /etc/yum.repos.d/
[root@node-01 yum.repos.d]# ls
Centos-altarch-7.repo CentOS-Base.repo CentOS-Huawei.repo epel.repo
二、备份原yum源
[root@node-01 yum.repos.d]# mkdir yum-back
[root@node-01 yum.repos.d]# mv CentOS-* yum-back/
[root@node-01 yum.repos.d]# ls
yum-back
三、替换yum源为阿里源
[root@localhost yum.repos.d]# cat Centos-altarch-7.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.aliyun.com/centos-altarch/$releasever/os/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos-altarch/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
enabled=1
#additional packages that extend functionality of existing packages
[centosplus]<

本文介绍如何将CentOS系统的默认yum源更改为阿里云镜像源,并完成相关配置及验证安装过程。首先备份原始yum源文件,然后修改CentOS-Base.repo等文件中的源地址为阿里云地址,导入新的GPG密钥并生成缓存,最后验证安装gcc-c++成功。
最低0.47元/天 解锁文章
3257

被折叠的 条评论
为什么被折叠?



