LoginSignup
8
7

More than 5 years have passed since last update.

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

Last updated at Posted at 2019-03-17

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/

以上。

8
7
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
8
7