一、镜像源修改
1. 备份原有的镜像源配置文件
在修改之前,先备份现有的 CentOS-Base.repo
文件:
sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2. 编辑镜像源配置文件
使用文本编辑器(如 nano
或 vi
)打开 /etc/yum.repos.d/CentOS-Base.repo
文件:
sudo vim /etc/yum.repos.d/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 pi