GeoIP Legacy City資料庫安裝說明

神馬和浮雲發表於2015-04-23

Here is a brief outline of the steps needed to install GeoIP Legacy City on Linux/Unix. The installation on Windows is similar, just replace the tar command with WinZip or a similar ZIP program.

Step 1 – Download database

For GeoIP clients, go to the download files page. You may need to enter your username and password. From there, you can download the binary or CSV formats of the GeoIP databases you purchased. Then you will want to upload the databases to your web server.

If you are not a client, you can use the free GeoLite database. You may download it from the GeoLite page.

If you are using the wget program to download the GeoLite file, please use the -N option to only download if the file has been updated:

$ wget -N http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

Step 2 – Install database

Once you have uploaded the database, you will want to uncompress it. To uncompress the binary format, you will need to unzip the file. For example, to uncompress the GeoIP City binary database on Linux or Unix, you could run:

$ gunzip GeoLiteCity.dat.gz

Then you will need to install the .dat file into a data directory. For example, on Linux/Unix, you could run:

$ mv GeoLiteCity.dat /usr/local/share/GeoIP/

To uncompress the CSV format, you can use any zip program, like WinZip for Windows, or unzip on Linux. Then you can load the CSV database into a SQL database. Learn more

Step 3 – Query database

For the binary databases, we supply APIs for most major programming languages. You may need to point the API code to the /usr/local/share/GeoIP/GeoLiteCity.dat location. Each API has documentation and example programs inside the downloaded distribution. The fastest way to get started is to use the example program included. You may need to replace the database path in the example program with the location where you installed the database.

For the CSV databases, once you have loaded them into a SQL database, you can issue SQL queries against the database table with the GeoIP data. Learn more

If you do not have shell access to the server

After you have downloaded the database, unzip it using a program like WinZip. Then rename the *.dat file to GeoIP.dat, GeoIPRegion.dat, or GeoIPCity.dat, for the GeoIP Country, Region or City databases, respectively. Finally upload the *.dat file to the /usr/local/share/GeoIP or other user-specified folder on your server using FTP or another upload mechanism.

相關文章