Creating a Geolocation Dataset¶
Follow the procedure below in order to create a geolocation dataset to use when Enabling Geolocation Based Statistics .
- Create an account in www.maxmind.com and download the GeoLite2 City: CSV Format as a ZIP file.
- Download the geoip-2-csv-converter from https://github.com/maxmind/geoip2-csv-converter/releases depending on your operating system.
Prepare the database entries¶
- Unzip the latest CSV file and the geoip-2-csv-converter you have downloaded in the previous step.
-
Run the
update-geolocation-data.sh
file using the command below.For Linux : update-geolocation-data.sh
For Mac: update-geolocation-data.sh
sh update-geolocation-data.sh
-
Enter the path to the extracted GeoLite2-City-Blocks-IPv4 directory which you downloaded first, as the response for Enter path to GeoLite2-City-Blocks-IPv4 directory:
E.g : /<PATH\_TO>/GeoLite2-City-CSV_20200310
-
Enter the path to the
geoip2-csv-converter
directory as the response for Enter path to geoip2-csv-converter home directory:E.g : /<PATH_TO>/geoip2-csv-converter-v1.1.0
-
After executing the script, you can find the
final.csv
file inside your current directory.** get first column form original ** change column name to ‘network_cidr’ ** Extract ip address data ** change column name to ‘network_blocks’ ** extract entries from original cut: /home/user/xxx/geoip2-csv-converter-v1.1x.0/GeoLite2-City-Blocks-IPv4-converted.csv: No such file or directory ** change column name to ‘network’ ** change column name to ‘broadcast’ ** merge csv files
-
-
The created
final.csv
file and theGeoLite2-City-Locations-en.csv
file (located in the downloaded latest CSV zip file) will be used in the next step.