LoginSignup
7

More than 3 years have passed since last update.

posted at

updated at

GeoLiteのLegacy版datがダウンロードできなくなったのでなんとかする話

GeoLite IPのdatはもうないんだってさ

これまで使っていたGeoIPタダ版(GeoLite IP)のdatファイルが404 Not Foundになってた。
下記に説明があるように、2019年1月2日から使えないらしい。
https://support.maxmind.com/geolite-legacy-discontinuation-notice/
古い形式はもう扱わないからGeoLite2に移行しろとか書いてある。

GeoLite2は下記のからダウンロードできるが、、、
https://dev.maxmind.com/geoip/geoip2/geolite2/

1.png

ダウンロードできるのはMaxMind DB形式かcsv形式となっている。古い形式であるdatはもういない。
困った。今動いている既存アプリのソースをいじるのは面倒だ。

ググればなんとかなる

世の中には同じように困って、何とかしてくれる親切な人がたくさんいる。
ググったら下記のツールを見つけた。
https://github.com/sherpya/geolite2legacy

ありがたく使わせてもらうことにする。
使い方はそのままExamplesに書いてある通りにやればOKだった。

[root@cent7 ~]# git clone https://github.com/sherpya/geolite2legacy.git 
[root@cent7 ~]# cd geolite2legacy/  
[root@cent7 geolite2legacy]# pip install -r requirements.txt
[root@cent7 geolite2legacy]# wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-City-CSV.zip
[root@cent7 geolite2legacy]# wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country-CSV.zip
[root@cent7 geolite2legacy]# wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN-CSV.zip
[root@cent7 geolite2legacy]# ./geolite2legacy.py -i GeoLite2-City-CSV.zip -f geoname2fips.csv -o GeoIPCity.dat
[root@cent7 geolite2legacy]# ./geolite2legacy.py -i GeoLite2-Country-CSV.zip -f geoname2fips.csv -o GeoIP.dat
[root@cent7 geolite2legacy]# ./geolite2legacy.py -i GeoLite2-ASN-CSV.zip -o GeoIPASNum.dat
[root@cent7 geolite2legacy]# cp *.dat /usr/share/GeoIP/

以上。

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
What you can do with signing up
7