{"id":3201,"date":"2013-07-23T17:08:29","date_gmt":"2013-07-23T09:08:29","guid":{"rendered":"http:\/\/staff.ie.cuhk.edu.hk\/~sfluk\/wordpress\/?p=3201"},"modified":"2013-07-23T17:08:29","modified_gmt":"2013-07-23T09:08:29","slug":"awstats-geoip","status":"publish","type":"post","link":"https:\/\/staff.ie.cuhk.edu.hk\/~sfluk\/wordpress\/?p=3201","title":{"rendered":"awstats + GeoIP"},"content":{"rendered":"<p>1.\u7576\u4f60\u5b89\u88dd\u865fAwstats\u5f8c\uff0c\u5831\u8868\u6703\u53cd\u89e3IP\u4f4d\u7f6e\uff0c\u7576\u7136\u4f60\u53ef\u4ee5\u52a0\u5165\u5916\u639b\u8b93Awstats\u986f\u793a\u570b\u5bb6\u8207\u7a0b\u5f0f\u9084\u6709\u7d44\u7e54\u7684\u8a0a\u606f<\/p>\n<p>2.\u4e0b\u8f09\u6240\u9700\u8981\u7684\u8cc7\u6599<br \/>\nwget <a title=\"Download file from MaxMind\" href=\"http:\/\/geolite.maxmind.com\/download\/geoip\/database\/GeoLiteCountry\/GeoIP.dat.gz\">http:\/\/geolite.maxmind.com\/download\/geoip\/database\/GeoLiteCountry\/GeoIP.dat.gz<\/a><br \/>\nwget <a title=\"Download file from MaxMind\" href=\"http:\/\/geolite.maxmind.com\/download\/geoip\/database\/GeoLiteCity.dat.gz\">http:\/\/geolite.maxmind.com\/download\/geoip\/database\/GeoLiteCity.dat.gz<\/a><br \/>\nwget <a title=\"Download file from MaxMind\" href=\"http:\/\/geolite.maxmind.com\/download\/geoip\/database\/asnum\/GeoIPASNum.dat.gz\">http:\/\/geolite.maxmind.com\/download\/geoip\/database\/asnum\/GeoIPASNum.dat.gz<\/a><\/p>\n<p>3.\u5efa\u7acb\u8cc7\u6599\u593e<code><br \/>\nsudo mkdir \/usr\/share\/GeoIP<br \/>\n<\/code><\/p>\n<p>4.\u79fb\u6a94\u8207\u89e3\u58d3\u7e2e<\/p>\n<pre><code>mv GeoIP.dat.gz \/usr\/share\/GeoIP\/\r\ngunzip \/usr\/share\/GeoIP\/GeoIP.dat.gz\r\n\r\nmv GeoLiteCity.dat.gz \/usr\/share\/GeoIP\/\r\ngunzip \/usr\/share\/GeoIP\/GeoLiteCity.dat.gz\r\n\r\nmv GeoIPASNum.dat.gz \/usr\/share\/GeoIP\/\r\ngunzip \/usr\/share\/GeoIP\/GeoIPASNum.dat.gz\r\n\r\n5.\u4e0b\u8f09\u8207\u5b89\u88ddGeoIP\u5957\u4ef6\r\n<\/code>wget http:\/\/geolite.maxmind.com\/download\/geoip\/api\/c\/GeoIP.tar.gz\r\ntar -xvzf GeoIP.tar.gz \r\ncd GeoIP-1.4.6\r\n\r\n.\/configure\r\nmake\r\nmake check\r\nsudo make install\r\n\r\n*\u6ce8\u610f\u4f60\u5728.\/configur\uff0c\u67e5\u770b\u662f\u5426\u6709\u932f\u8aa4\uff0c\u7248\u4e3b\u51fa\u73fe\u5c11\u4e00\u500b\u5957\u4ef6\u540d\u7a31\r\nconfigure: error: Zlib header (zlib.h) not found. Tor requires zlib to build. You may need to install a zlib development package.\r\n\r\n\u5b89\u88dd\u7f3a\u5c11\u7684\u5957\u4ef6\r\nsudo apt-get install zlib1g-dev\r\n\u8a18\u5f97\u5728\u91cd\u65b0.\/configure \u5f8c\uff0c\u5728\u63a5\u4e0b\u53bbmake......\u7b49\u7b49\u6b65\u9a5f\r\n\r\n6.\u4e0b\u8f09\u5b89\u88dd\u7de8\u8b6f\u7a0b\u5f0f\r\nwget http:\/\/geolite.maxmind.com\/download\/geoip\/api\/perl\/Geo-IP-1.38.tar.gz\r\n\r\ntar -xvzf Geo-IP-1.38.tar.gz\r\ncd Geo-IP-1.38\r\n\r\nperl Makefile.PL LIBS='-L\/usr\/local\/lib'\r\nmake\r\nmake test\r\nsudo make install\r\n\r\n7.\u4fee\u6539sudo vi \/etc\/awstats\/awstats.www.conf\u6a94\u6848\r\nDNSLOOKUP=0\r\nLoadPlugin=\"geoip GEOIP_STANDARD \/usr\/share\/GeoIP\/GeoIP.dat\"\r\nLoadPlugin=\"geoip_city_maxmind GEOIP_STANDARD \/usr\/share\/GeoIP\/GeoLiteCity.dat\"\r\nLoadPlugin=\"geoip_org_maxmind GEOIP_STANDARD \/usr\/share\/GeoIP\/GeoIPASNum.dat\"\r\n\r\n8.\u5b8c\u6210\r\n\r\n\u53c3\u8003\u6587\u4ef6:\r\nhttp:\/\/www.antezeta.com\/awstats\/geoip.html<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1.\u7576\u4f60\u5b89\u88dd\u865fAwstats\u5f8c\uff0c\u5831\u8868\u6703\u53cd\u89e3IP\u4f4d\u7f6e\uff0c\u7576\u7136\u4f60\u53ef\u4ee5\u52a0\u5165\u5916\u639b\u8b93Awstats\u986f\u793a\u570b\u5bb6\u8207\u7a0b\u5f0f\u9084\u6709\u7d44\u7e54\u7684\u8a0a\u606f<\/p>\n<p>2.\u4e0b\u8f09\u6240\u9700\u8981\u7684\u8cc7\u6599 wget http:\/\/geolite.maxmind.com\/download\/geoip\/database\/GeoLiteCountry\/GeoIP.dat.gz wget http:\/\/geolite.maxmind.com\/download\/geoip\/database\/GeoLiteCity.dat.gz wget http:\/\/geolite.maxmind.com\/download\/geoip\/database\/asnum\/GeoIPASNum.dat.gz<\/p>\n<p>3.\u5efa\u7acb\u8cc7\u6599\u593e sudo mkdir \/usr\/share\/GeoIP <\/p>\n<p>4.\u79fb\u6a94\u8207\u89e3\u58d3\u7e2e<\/p>\n<p> mv GeoIP.dat.gz \/usr\/share\/GeoIP\/ gunzip \/usr\/share\/GeoIP\/GeoIP.dat.gz mv GeoLiteCity.dat.gz \/usr\/share\/GeoIP\/ gunzip \/usr\/share\/GeoIP\/GeoLiteCity.dat.gz mv GeoIPASNum.dat.gz \/usr\/share\/GeoIP\/ gunzip \/usr\/share\/GeoIP\/GeoIPASNum.dat.gz 5.\u4e0b\u8f09\u8207\u5b89\u88ddGeoIP\u5957\u4ef6 wget http:\/\/geolite.maxmind.com\/download\/geoip\/api\/c\/GeoIP.tar.gz tar -xvzf GeoIP.tar.gz cd GeoIP-1.4.6 .\/configure make make check sudo make install *\u6ce8\u610f\u4f60\u5728.\/configur\uff0c\u67e5\u770b\u662f\u5426\u6709\u932f\u8aa4\uff0c\u7248\u4e3b\u51fa\u73fe\u5c11\u4e00\u500b\u5957\u4ef6\u540d\u7a31 configure: error: Zlib header (zlib.h) not found. Tor requires zlib [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-3201","post","type-post","status-publish","format-standard","hentry","category-computer","odd"],"_links":{"self":[{"href":"https:\/\/staff.ie.cuhk.edu.hk\/~sfluk\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/staff.ie.cuhk.edu.hk\/~sfluk\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/staff.ie.cuhk.edu.hk\/~sfluk\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/staff.ie.cuhk.edu.hk\/~sfluk\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/staff.ie.cuhk.edu.hk\/~sfluk\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3201"}],"version-history":[{"count":1,"href":"https:\/\/staff.ie.cuhk.edu.hk\/~sfluk\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3201\/revisions"}],"predecessor-version":[{"id":3202,"href":"https:\/\/staff.ie.cuhk.edu.hk\/~sfluk\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3201\/revisions\/3202"}],"wp:attachment":[{"href":"https:\/\/staff.ie.cuhk.edu.hk\/~sfluk\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/staff.ie.cuhk.edu.hk\/~sfluk\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/staff.ie.cuhk.edu.hk\/~sfluk\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}