GeoIP uses a large database to find information about a given IP address or website. I went through a couple different package installations before it integrated with my programs successfully. The fairly simple process I settled upon to set up the functional package, pygeoip (python API for GeoIP), is as follows:
sudo easy_install pygeoip cd <span style="color: #808030;">/</span>usr <div style="font-family: verdana;"> To find the path of GeoIP.dat, embrace the power of ` (not ', ` on US keyboards shares a key with ~). </div> find <span style="color: #e34adc;">`pwd`</span> <span style="color: #808030;">-</span>name <span style="color: #0000e6;">'GeoIP.dat'</span>After downloading GeoLiteCity.dat, a simple way rename the file to GeoIPCity.dat whilst moving said file to the same path as GeoIP.dat (for convenience)...sudo mv Downloads/GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat
In order to check the success of your environment's set-up, run this as a py script or in a term window<span style="color: maroon; font-weight: bold;">import</span> pygeoip <span style="color: dimgrey;">#gi = pygeoip.GeoIP('/usr/share/GeoIP/GeoIP.dat', pygeoip.MEMORY_CACHE)</span> gi <span style="color: #808030;">=</span> pygeoip<span style="color: #808030;">.</span>GeoIP<span style="color: #808030;">(</span><span style="color: #0000e6;">'/usr/share/GeoIP/GeoIPCity.dat'</span><span style="color: #808030;">)</span> <span style="color: maroon; font-weight: bold;">print</span> gi<span style="color: #808030;">.</span>record_by_addr<span style="color: #808030;">(</span><span style="color: #0000e6;">'64.233.161.99'</span><span style="color: #808030;">)</span>(Thanks http://tohtml.com/)