yum源404导致Could not resolve host: mirrorlist.centos.org

yum源更换错误问题记录
网上查询到的部分源过旧,现在已经不存在404,可以将报错信息中的无法访问的地址在浏览器中尝试。如下http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock这个地址就已经不在。
可以网上搜一下最新的镜像源,如http://mirrors.aliyun.com/repo/Centos-7.repo、http://mirrors.163.com/.help/CentOS7-Base-163.repo等,可以手动下载,再将内容覆盖,也可以wget直接下载(但是我的wget也出问题了需要yum安装)

[root@wenzhu ~]# yum makecache
已加载插件:fastestmirror
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"


 One of the configured repositories failed (未知),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo= ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable 
        or
            subscription-manager repos --disable=

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=.skip_if_unavailable=true

Cannot find a valid baseurl for repo: extras/7/x86_64
[root@wenzhu ~]# vi /etc/yum.repos.d/CentOS-Base.repo
[root@wenzhu ~]# yum clean all
已加载插件:fastestmirror
正在清理软件源: base extras updates
Cleaning up list of fastest mirrors
[root@wenzhu ~]# yum makecache
已加载插件:fastestmirror
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                                                                                                                   | 3.6 kB  00:00:00     
extras                                                                                                                                                                                                                                                 | 2.9 kB  00:00:00     
updates                                                                                                                                                                                                                                                | 2.9 kB  00:00:00     
(1/10): base/7/x86_64/group_gz                                                                                                                                                                                                                         | 153 kB  00:00:00     
(2/10): extras/7/x86_64/filelists_db                                                                                                                                                                                                                   | 305 kB  00:00:00     
(3/10): extras/7/x86_64/other_db                                                                                                                                                                                                                       | 154 kB  00:00:00     
(4/10): base/7/x86_64/other_db                                                                                                                                                                                                                         | 2.6 MB  00:00:00     
(5/10): updates/7/x86_64/filelists_db                                                                                                                                                                                                                  |  15 MB  00:00:02     
(6/10): updates/7/x86_64/other_db                                                                                                                                                                                                                      | 1.6 MB  00:00:00     
(7/10): updates/7/x86_64/primary_db                                                                                                                                                                                                                    |  27 MB  00:00:03     
extras/7/x86_64/primary_db     FAILED                                          
http://mirrors.aliyuncs.com/centos/7/extras/x86_64/repodata/e12dbf10e94bc2b33b1f45e026559bc8685728b139dddae0654d96bc624c5602-primary.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"        ] 7.1 MB/s |  45 MB  00:00:02 ETA 
正在尝试其它镜像。
base/7/x86_64/primary_db       FAILED                                          
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/6d0c3a488c282fe537794b5946b01e28c7f44db79097bb06826e1c0c88bad5ef-primary.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.cloud.aliyuncs.com:80; Connection refused"] 7.1 MB/s |  45 MB  00:00:02 ETA 
正在尝试其它镜像。
base/7/x86_64/filelists_db     FAILED                                          
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/d6d94c7d406fe7ad4902a97104b39a0d8299451832a97f31d71653ba982c955b-filelists.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"          ] 7.1 MB/s |  45 MB  00:00:02 ETA 
正在尝试其它镜像。
(8/10): extras/7/x86_64/primary_db                                                                                                                                                                                                                     | 253 kB  00:00:00     
(9/10): base/7/x86_64/primary_db                                                                                                                                                                                                                       | 6.1 MB  00:00:00     
(10/10): base/7/x86_64/filelists_db                                                                                                                                                                                                                    | 7.2 MB  00:00:01     
元数据缓存已建立
[root@wenzhu ~]# 

你可能感兴趣的:(centos,linux,运维)