You can follow the steps below to change the YUM software source of CentOS 7 to the mirror source of Alibaba Cloud:
-
Back up the original CentOS-Base.repo file first
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
-
Download the repo file of Alibaba Cloud's CentOS 7
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
-
Clear and generate new cache
sudo yum clean all sudo yum makecache
Now your CentOS 7 yum software source should have been changed to the Alibaba Cloud mirror source, you can try to install or update the software package to see if it succeeds.
This process assumes that your system has the wget command, if not, you can use yum install wget -y
the command to install it first. At the same time, this process requires corresponding network access rights, otherwise the repo file cannot be downloaded from Alibaba Cloud.