Automatic update of IP database

Source: Internet
Author: User
Tags geoip maxmind

Here we will introduce several free IP database updates. For foreign IP address data, we use the maxmind open-source project geoip, and the domestic IP data we use pure qqwry, because qqwry is in rara format, first, install unrar in the system.
wget http://www.rarlab.com/rar/unrar-3.7.7-centos.gz
gzip -d unrar-3.7.7-centos.gz
mv unrar-3.7.7-centos /usr/local/bin/

Write the following script to automatically synchronize IP data to the/usr/local/share directory.
VI update_ipdata.sh
#!/bin/bash
if [ ! -d /usr/local/share/GeoIP ] ; then
mkdir /usr/local/share/GeoIP
fi
if [ ! -d /usr/local/share/qqIP ] ; then
mkdir /usr/local/share/qqIP
fi
wget -t 5 -O /tmp/GeoIP.dat.gz http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget -t 5 -O /tmp/GeoLiteCity.dat.gz http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
wget -t 5 -O /tmp/GeoIPASNum.dat.gz http://geolite.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz
wget -t 5 -O /tmp/qqwry.rar http://update.cz88.net/soft/qqwry.rar

gzip -df /tmp/GeoIP.dat.gz
gzip -df /tmp/GeoLiteCity.dat.gz
gzip -df /tmp/GeoIPASNum.dat.gz
/usr/local/bin/unrar e -nQQWry.Dat -o+ /tmp/qqwry.rar /tmp/
mv -f /tmp/Geo*.dat /usr/local/share/GeoIP/
mv -f /tmp/QQWry.Dat /usr/local/share/qqIP/

We update the IP database at every Wednesday morning:
20 6 *** 3/usr/local/AWStats/update-ipdata-cron.sh
Finally, check the directory configuration, view AWStats. Common. conf, and modify the following three lines:
LoadPlugin="geoip GEOIP_STANDARD /usr/local/share/GeoIP/GeoIP.dat"
LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/local/share/GeoIP/GeoLiteCity.dat"
LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /usr/local/share/GeoIP/GeoIPASNum.dat"

In the AWStats/wwwroot/cgi-bin/Plugins directory, modify qqwry. pl
My $ ipfile = "/qqwry. dat ";
To:
My $ ipfile = "/usr/local/share/qqip/qqwry. dat ";

For more information about how to install geoip, see the AWStats blog of antezenta. For more information about pure database format, see the qqwry format resolution of lumaqq. For PHP parsing QQ format, consider using the PHP extension of qqwry (C code)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.