Switch to domestic source
1) Back up the EPEL source that comes with Linux
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
Note:
The mv command in Linux is used to rename a file or directory, or move a file or directory to another location
mv [options] source dest Change the source file name to the target file name
mv [options] source directory Move the file to the target directory
Options description:
-i If there is already a file with the same name in the specified directory, first ask whether to overwrite the old file
-f No prompt will be given when the mv operation wants to overwrite the existing target file
2) Generate Ali source
cd /etc/yum.repos.d
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget non-interactive network file download tool
usage: wget [option]... [url]...
-o --output followed by the file name, write the information to the specified file
-a --append-output followed by file name, add information to the specified file
-d --debug print debug information
-q --quiet quiet mode
-F --force-html treat input file as html file
-t --tries=num Set the number of retries
-nc --no-clobber Do not download existing files repeatedly
3) Clear the cache
yum clean all
4) Regenerate the cache
yum makecache
Used to test yum -y install tree after changing the source
Screenshot shows: