質問: yumがcent-osで機能しない 新しいcent-os 7をインストールしましたが、更新または新しいパッケージを取得したい場合、 このエラー:loaded plugins: fastestmirror, langpacks 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. disable the repository, 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> 4. 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 cannot find a valid baseurl for repo: base/7/x86_64` これはyum repolist allです:repo id repo name status c7.0.1406-base/x86_64 centos-7.0.1406 - base disabled c7.0.1406-centosplus/x86_64 centos-7.0.1406 - centosplus disabled c7.0.1406-extras/x86_64 centos-7.0.1406 - extras disabled c7.0.1406-fasttrack/x86_64 centos-7.0.1406 - centosplus disabled c7.0.1406-updates/x86_64 centos-7.0.1406 - updates disabled base/7/x86_64 centos-7 - base enabled: 0 base-debuginfo/x86_64 centos-7 - debuginfo disabled base-source/7 centos-7 - base sources disabled centosplus/7/x86_64 centos-7 - plus disabled centosplus-source/7 centos-7 - plus sources disabled cr/7/x86_64 centos-7 - cr disabled extras/7/x86_64 centos-7 - extras enabled: 0 extras-source/7 centos-7 - extras sources disabled fasttrack/7/x86_64 centos-7 - fasttrack disabled updates/7/x86_64 centos-7 - updates enabled: 0 updates-source/7 centos-7 - updates sources disabled repolist: 0 および/etc/yum.repos.d/centos-base.repoの内容:# centos-base.repo # # the mirror system uses the connecting ip address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. you should use this for centos updates # unless you are manually picking other mirrors. # # if the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=centos-$releasever - base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7 #released updates [updates] name=centos-$releasever - updates mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7 #additional packages that may be useful [extras] name=centos-$releasever - extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7 #additional packages that extend functionality of existing packages [centosplus] name=centos-$releasever - plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7 centos-base.repoのbaseurlのコメントを外した後、このエラーが発生しました もう一度ですが、前回とは異なります:failure: repodata/repomd.xml from base: [errno 256] no more mirrors to try. http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [errno 14] curl#6 - "could not resolve host: mirror.centos.org; unknown error"
回答: 失敗する理由は、yumがリポジトリurlを知っている必要があるためです。あなたの設定ファイルには、これがあります:#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ #記号はコメント化されていることを意味します。したがって、yumはその行を無視し、urlがどれであるかを認識しません。ハッシュ記号を削除して、通常はyumを使用します。注:他のリポジトリが重要であるため、コメントしたanybaseurlから削除する必要があります同じように。