关于centos7仓库归档导致yum源更新失败问题Could not retrieve mirrorlist http://mirrorlist.centos.org?arch=x86_64

关于centos7仓库归档导致yum源更新失败问题,报错

Loaded plugins: fastestmirror
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org?arch=x86_64&release=7&repo=sclo-rh error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"


 One of the configured repositories failed (Unknown),
 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 <repoid>
        or
            subscription-manager repos --disable=<repoid>

     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=<repoid>.skip_if_unavailable=true

首先:这个肯定不是你本机网络问题

备份repo源

cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

替换阿里云源

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

有的小伙伴下面还会有别的repo,可以grep 一下

grep 'mirrorlist.centos.org' *.repo
CentOS-SCLo-scl.repo:mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-sclo
CentOS-SCLo-scl-rh.repo:mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh
[root@iZ2ze3xzcbk8i755ufsi5kZ yum.repos.d]# sed -i.bak 's/mirrorlist/#mirrorlist/g' CentOS-SCLo-scl.repo
[root@iZ2ze3xzcbk8i755ufsi5kZ yum.repos.d]# 
[root@iZ2ze3xzcbk8i755ufsi5kZ yum.repos.d]# sed -i.bak 's/mirrorlist/#mirrorlist/g' CentOS-SCLo-scl-rh.repo
vi /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
[centos-sclo-rh]
name=CentOS-$releasever - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/rh/
gpgcheck=1
enabled=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
vi /etc/yum.repos.d/CentOS-SCLo-scl.repo
[centos-sclo-sclo]
name=CentOS-$releasever - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/$releasever/sclo/$basearch/sclo/
gpgcheck=1
enabled=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

其实这里还是有问题,可以参考这篇博客
yum 报错

你可能感兴趣的:(自己新建项目遇到问题,linux,centos)