CentOS 7エラーの解決:リポジトリextras7x86_64の有効なbaseurlが見つかりません



Solve Centos 7 Error



この記事は、荒野の夢、元のリンクによってオリジナルです: http://zhaokaifeng.com/?p=1361

動作環境

[root@xxxxx ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core)

エラーの詳細

最小限のインストールで仮想化インストールにCentOS7をインストールしました。インストールの完了後、ローカルのyumソースを構成するとき、実行するときyum makecacheパッケージのローカルキャッシュを生成するときに、次のエラーが報告されました。

[root@xxxxx ~]# yum makecache Loaded plugin: fastestmirror Determining fastest mirrors 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 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 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

エラー分析

エラーでは、「ミラーリストを取得できませんでした...」と表示されます。取得できないため、ミラーリストのアドレスにpingを実行できるかどうかを確認できます。

[root@xxxxx ~]# ping mirrorlist.centos.org Ping: mirrorlist.centos.org: Unknown name or service

結果は、pingに到達できないことを示しており、プロンプトによると、エラーはDNSサーバー(「不明な名前またはサービス」)を構成していないことが原因である可能性があります。直接pingIPアドレスを渡すことができるため、システムはすでにインターネットに接続されています(基本的な缶決定はDNS解決の問題です)。

[root@xxxxx ~]# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=128 time=65.9 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=128 time=64.8 ms ^Z [1]+ stopped ping 8.8.8.8

分析後、エラーの理由の1つは、DNSサーバーが構成されておらず、システムがyumソースのドメイン名を解決できず、yumソースのミラーサーバーに接続できないと見なして送信することです。エラー。

解決

CentOS7のDNS構成ファイルを編集します。

vi /etc/resolv.conf

書く:

nameserver 8.8.8.8

次に、システムを再起動するか、ネットワークを再起動します。

ネットワークモード1を再起動します:

[root@xxxxx ~]# service network restart Restarting network (via systemctl): [ OK ]

ネットワークモード2を再起動します。

[root@xxxxx ~]# systemctl restart network [root@xxxxx ~]#

この時点で、問題は解決されています。