Opensourcetechブログ

OpensourcetechによるNGINX/Kubernetes/Zabbix/Neo4j/Linuxなどオープンソース技術に関するブログです。

yumでepel使った時、「Could not get metalink https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=x86_64」って怒られたもんで

 

こんにちは、LinuCエバンジェリストこと、鯨井貴博@opensourcetechです。

 

yumでepel使った時、「Could not get metalink https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=x86_64」って出力されてどうしようもないときのメモです。

f:id:opensourcetech:20200529103212p:plain




事象発生までの流れ

簡単ですが、以下のようになります。

①通常のレポジトリで入らないパッケージをインストールしたいので、EPELを使えるようにする。※CentOS7で操作してます。

[root@db01 ~]# yum install epel-release
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp-srv2.kddilabs.jp
* extras: ftp-srv2.kddilabs.jp
* updates: ftp-srv2.kddilabs.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ epel-release.noarch 0:7-11 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

================================================================================
Package アーキテクチャー バージョン リポジトリー 容量
================================================================================
インストール中:
epel-release noarch 7-11 extras 15 k

トランザクションの要約
================================================================================
インストール 1 パッケージ

総ダウンロード容量: 15 k
インストール容量: 24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-11.noarch.rpm | 15 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
インストール中 : epel-release-7-11.noarch 1/1
検証中 : epel-release-7-11.noarch 1/1

インストール:
epel-release.noarch 0:7-11

完了しました!

 ②レポジトリファイルが追加される。

[root@db01 ~]# cat /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$base arch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$bas earch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

 ③yumすると怒られる。

[root@db01 ~]# yum search nkf
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 7.9 kB 00:00
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_6 4&repo=extras&infra=stock error was
14: curl#7 - "Failed connect to mirrorlist.centos.org:80; 現在処理中の操作です"


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

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

Cannot find a valid baseurl for repo: extras/7/x86_64

 

 

 事象の回避方法

以下のように、3行目を有効化し、4行目をコメント化(先頭に#ハッシュをつける)します。

[root@db01 ~]# vi /etc/yum.repos.d/epel.repo
[root@db01 ~]# cat -n /etc/yum.repos.d/epel.repo
1 [epel]
2 name=Extra Packages for Enterprise Linux 7 - $basearch
3 baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
4 #metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
5 failovermethod=priority
6 enabled=1
7 gpgcheck=1
8 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
9
10 [epel-debuginfo]
11 name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
12 #baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
13 metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
14 failovermethod=priority
15 enabled=0
16 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
17 gpgcheck=1
18
19 [epel-source]
20 name=Extra Packages for Enterprise Linux 7 - $basearch - Source
21 #baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
22 metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
23 failovermethod=priority
24 enabled=0
25 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
26 gpgcheck=1

 

すると、OK!

[root@db01 ~]# yum --disablerepo=\* --enablerepo=epel install nkf
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
epel | 4.7 kB 00:00
(1/3): epel/x86_64/group_gz | 95 kB 00:38
epel/x86_64/updateinfo FAILED
http://download.fedoraproject.org/pub/epel/7/x86_64/repodata/8cf95b3cb8756354f4e 8f465747a1280ecbe8acdf030a139400f1cb5af3a8d3c-updateinfo.xml.bz2: [Errno 14] HTT P Error 404 - Not Found
他のミラーを試します。
To address this issue please refer to the below wiki article

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.cent os.org/.

(2/3): epel/x86_64/primary_db | 6.8 MB 00:38
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ nkf.x86_64 1:2.1.3-5.el7 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

================================================================================
Package アーキテクチャー バージョン リポジトリー 容量
================================================================================
インストール中:
nkf x86_64 1:2.1.3-5.el7 epel 135 k

トランザクションの要約
================================================================================
インストール 1 パッケージ

総ダウンロード容量: 135 k
インストール容量: 293 k
Is this ok [y/d/N]: y
Downloading packages:
警告: /var/cache/yum/x86_64/7/epel/packages/nkf-2.1.3-5.el7.x86_64.rpm: ヘッダー V3 RSA/SHA256 Signature、鍵 ID 352c64e5: NOKEY
nkf-2.1.3-5.el7.x86_64.rpm の公開鍵がインストールされていません
nkf-2.1.3-5.el7.x86_64.rpm | 135 kB 00:45
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 から鍵を取得中です。
Importing GPG key 0x352C64E5:
Userid : "Fedora EPEL (7) <epel@fedoraproject.org>"
Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
Package : epel-release-7-11.noarch (@extras)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
上記の処理を行います。よろしいでしょうか? [y/N]y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
インストール中 : 1:nkf-2.1.3-5.el7.x86_64 1/1
検証中 : 1:nkf-2.1.3-5.el7.x86_64 1/1

インストール:
nkf.x86_64 1:2.1.3-5.el7

完了しました!

 

 

 

アフィリエイトのアクセストレード

 

 

 

 

 

 

www.slideshare.net

github.com

www.facebook.com

twitter.com

www.instagram.com

 

 

にほんブログ村 IT技術ブログ Linuxへ
Linux

にほんブログ村 IT技術ブログ オープンソースへ
オープンソース

 

 

Opensourcetech by Takahiro Kujirai