LoginSignup
0
1

More than 5 years have passed since last update.

CentOS7でyumでnginxの最新版が入らない時( [Errno 256] No more mirrors to try)

Posted at

yumのデフォルトでは古いnginxがインストールされるので、新しくリポジトリファイルを作ってそちらを見に行くようにした

これは安定版

stableVersionの/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1

今回最新版を入れたかったので、以下のように変更

/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/(これを)
↓
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/(こうする)
gpgcheck=0
enabled=1

一度removeしてからinstallし直す

$ sudo yum -y --enablerepo=nginx remove nginx
$ sudo yum -y --enablerepo=nginx install nginx
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: mirror.dmmlabs.jp
 * extras: ftp.iij.ad.jp
 * remi-safe: repo1.sea.innoscale.net
 * updates: ftp.iij.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.12.2-1.el7_4.ngx will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================
 Package                   Arch                       Version                                     Repository                 Size
==================================================================================================================================
Installing:
 nginx                     x86_64                     1:1.12.2-1.el7_4.ngx                        nginx                     716 k

Transaction Summary
==================================================================================================================================
Install  1 Package

Total download size: 716 k
Installed size: 2.5 M
Downloading packages:
nginx-1.12.2-1.el7_4.ngx.x86_6 FAILED                                          
http://nginx.org/packages/mainline/centos/7/x86_64/RPMS/nginx-1.12.2-1.el7_4.ngx.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/
Error downloading packages:
  1:nginx-1.12.2-1.el7_4.ngx.x86_64: [Errno 256] No more mirrors to try.

1.13をインストールしたいのに、なぜか頭の方で
nginx.x86_64 1:1.12.2-1.el7_4.ngxをインストールすることが決まっている
nginx.repoを指定しているのだから、そのbaseurlを見に行くものかと思いきや
メッセージを見るとcached hostfileから決められているようだ
なのでそのcached hostfileを消す
【yum】yumが動かないときの簡易対処方法集(IOError、Trying other mirror、Determining fastest mirrors、フリーズ等)
こちらを参考にしました。

$ sudo rm -f /var/run/yum.pid
$ sudo rm -rf /var/lib/rpm/__db.00?
$ sudo rpm --rebuilddb
$ sudo yum clean all

Loaded plugins: fastestmirror, langpacks
Cleaning repos: base epel extras nginx remi-safe updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors

と言われたので、

$ sudo rm -rf /var/cache/yum/x86_64/7/

こちらも削除。使わないキャッシュらしい。

もう一度installすると、キャッシュファイルが再構築され無事インストール出来ました。

$ sudo yum -y --enablerepo=nginx install nginx.x86_64
Loaded plugins: fastestmirror, langpacks
base                                                                                                       | 3.6 kB  00:00:00     
epel/x86_64/metalink                                                                                       | 5.9 kB  00:00:00     
epel                                                                                                       | 4.7 kB  00:00:00     
http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/7/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel                                                                                                       | 4.7 kB  00:00:00     
http://ftp.riken.jp/Linux/fedora/epel/7/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel                                                                                                       | 4.7 kB  00:00:00     
extras                                                                                                     | 3.4 kB  00:00:00     
nginx                                                                                                      | 2.9 kB  00:00:00     
remi-safe                                                                                                  | 2.9 kB  00:00:00     
updates                                                                                                    | 3.4 kB  00:00:00     
(1/9): base/7/x86_64/group_gz                                                                              | 156 kB  00:00:00     
(2/9): extras/7/x86_64/primary_db                                                                          | 130 kB  00:00:00     
(3/9): epel/x86_64/group_gz                                                                                | 261 kB  00:00:00     
(4/9): base/7/x86_64/primary_db                                                                            | 5.7 MB  00:00:00     
(5/9): updates/7/x86_64/primary_db                                                                         | 3.6 MB  00:00:00     
epel/x86_64/primary_db         FAILED                                          
http://ae.mirror.rasanegar.com/fedoraproject/pub/epel/7/x86_64/repodata/5e3e7ed1a51fc4f466daad159593b466163d334366d456b2e0f3e0403c6ae66d-primary.sqlite.bz2: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/

(6/9): nginx/x86_64/primary_db                                                                             |  87 kB  00:00:01     
(7/9): epel/x86_64/primary_db                                                                              | 6.1 MB  00:00:01     
(8/9): remi-safe/primary_db                                                                                | 1.1 MB  00:00:02     
epel/x86_64/updateinfo         FAILED                                          
http://mirror.dmmlabs.jp/linux/fedora/epel/7/x86_64/repodata/3c7c3e414b0217c165d60c62bf30315d663c266f8922f742544db9a3eaddc6b3-updateinfo.xml.bz2: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
(9/9): epel/x86_64/updateinfo                                                                              | 847 kB  00:00:00     
Determining fastest mirrors
 * base: ftp.iij.ad.jp
 * epel: ftp.riken.jp
 * extras: ftp.iij.ad.jp
 * remi-safe: mirrors.thzhost.com
 * updates: ftp.iij.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.13.6-1.el7_4.ngx will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================
 Package                   Arch                       Version                                     Repository                 Size
==================================================================================================================================
Installing:
 nginx                     x86_64                     1:1.13.6-1.el7_4.ngx                        nginx                     723 k

Transaction Summary
==================================================================================================================================
Install  1 Package

Total download size: 723 k
Installed size: 2.5 M
Downloading packages:
nginx-1.13.6-1.el7_4.ngx.x86_64.rpm                                                                        | 723 kB  00:00:02     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
warning: Failed to open SELinux handle.
  Installing : 1:nginx-1.13.6-1.el7_4.ngx.x86_64                                                                              1/1 
----------------------------------------------------------------------

Thanks for using nginx!

Please find the official documentation for nginx here:
* http://nginx.org/en/docs/

Please subscribe to nginx-announce mailing list to get
the most important news about nginx:
* http://nginx.org/en/support.html

Commercial subscriptions for nginx are available on:
* http://nginx.com/products/

----------------------------------------------------------------------
  Verifying  : 1:nginx-1.13.6-1.el7_4.ngx.x86_64                                                                              1/1 

Installed:
  nginx.x86_64 1:1.13.6-1.el7_4.ngx                                                                                               

Complete!

もう一回再現してみると

sudo rm -rf /var/cache/yum/x86_64/7/

だけで出来たので、/var/cache/yum/x86_64/7/nginx/の中の(英数字羅列)1-primary.sqlite.bz2の中にそのリストみたいなのが入ってる気がするのですが、
中がバイナリで見方がわからない

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1