Step 1: download the configuration file of Ali source code.
wget-O/etc/yum . repos . d/CentOS-base . repo/repo/CentOS-7 . repo
Step 2: Update the mirror source
Clear yum cache
Yum cleans all.
Generate yum cache
yum makecache
Error report:
Plug-ins loaded: langpacks, product-ID, subscription-manager This system is not registered with red hat subscription management. You can use subscription-manager to register.
/centos/7server/OS/x86 _ 64/Repodata/Repomd.xml: [errno14] HTTP error 404-not found.
Try another mirror.
/centos/7server/OS/x86 _ 64/Repodata/Repomd.xml: [errno14] curl # 7-"Connection to mirrors.aliyuncs.com:80 failed; Connection denied "
Error reason: The releaser variable in the Centos-Base.repo configuration file was parsed incorrectly, resulting in the whole URL address error. This usually happens when Centos source (my system is Redhat 7), "/centos/" is installed on the red hat system, and it is found that there is no 7Server/ directory. Therefore, the $ releaseever variable should be parsed as "7Server", which leads to an error. The correct URL address is/centos/7/OS/x86 _ 64/Repodata/Repomd.xml, where "7" refers to the system version number.
Third, the solution
1. Modify yum configuration file.
VI/etc/yum . repos . d/CentOS-base . repo
Replace all "$ releaseever" strings in the full text with "7" because my system is version 7.
Enter ":"to enter the last line mode.
Then enter% s/$ releaser/7/g 7/g.
Save and exit
2. Update the mirror source again.
Clear yum cache
Yum cleans all.
Generate yum cache
yum makecache
After modifying the configuration file, the error message that the address cannot be accessed will still appear when executing the yum makecache command, but this does not affect it. If you don't want to see the error message, just delete some information of aliyuncs.