Has the installation process changed? - GeoLite2-City.mmdb - What is the full path?

I am getting stuck on Step 3 of the Getting Started page. I am not able to find the option to download the GeoLite2-City database (https://www.mautic.org/docs/setup/getting_started.html).



When I look in the mautic_prod-2016-04-09.php log file I see this error:



[2016-04-09 19:24:39] mautic.WARNING: IP LOOKUP: The file “/home1/username/public_html/mautic/app/cache/prod/…/ip_data/GeoLite2-City.mmdb” does not exist or is not readable. [] []



The Getting Started page directs you to " On the System Settings tab, find the IP lookup service option and click the “Fetch IP Lookup Data Store.”".



The “Ip lookup service” options, when the drop down is opened, extends past the edge of my monitor and I cannot see any “Fetch” options. When I scroll within the opened drop box, no fetch options are revealed.



When I search the server for the “ip-data” path as indicated in the error log it is not present on my shared server.



Has the installation process changed?



If I download the database from MaxMind.com what is the correct path. The path in the log file is truncated (prod/…/ip_data/)



I know this is basic, but darn I am searching, reading and exploring the forums looking for answers. I’m failing but it is not for a lack of trying.



Your comments will be welcomed.



CraigM

If I knew how I would mark this question as: SOLVED

So that others can follow along I recorded what I did to update MaxMinds’s GeoLite2-City database monthly as MaxMind releases database updates…

Here it is:

How to Obtain and update MaxMinds’s GeoLite2-City database.

  1. Go to http://dev.maxmind.com/geoip/geoip2/geolite2/ and download the “MaxMind DB binary, gzipped” version.

  2. Extract the resulting file from GeoLite2-City.mmdb.gz to GeoLite2-City.mmdb using PKZip or other compression utility.

  3. Copy (ftp) the file GeoLite2-City.mmdb to your server: (directory-structure)/public_html/mautic/app/cache/ip_data

Note: Modifying (directory-structure) to reflect your server’s directory structure. Your directory structure can be determined in your C Panel under “Account Information” or by using your C Panel’s File Manager. In File Manager at the top of the Directory tree (on the left) you will see a little house Icon. That is your (directory structure).

Note: I copied (ftp) the file to ensure that I was able to create the file in the ip_data directory which should already be present under the current release of Mautic. If it does not exist, create it.

Create the update-maxmind-database Cron Job for IP Lookup

  1. Create a blank update-maxmind-database.txt file in notepad and paste the following into it modifying (directory-structure) to reflect your server directory structure.

#!/bin/bash wget -N -P (directory-structure)/public_html/mautic/app/cache/ip_data http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz gunzip -f (directory-structure)/public_html/mautic/app/cache/ip_data/*.gz

  1. Save the file as update-maxmind-database.txt

  2. Copy (ftp) the update-maxmind-database.txt to the (directory-structure) directory. In my case I put it in the root directory.

  3. Rename your file (update-maxmind-database.txt) it removing the .txt to update-maxmind-database using the File Manager from your C Panel.

  4. Change the file permissions to full read, write, execute permissions using the File Manager from your C Panel.

Create a new Cron Job from within your C Panel as follows:

  1. Enter your Cron Jon Command string as follows:
(directory-structure)/update-maxmind-database

Note: Modify (directory-structure) to reflect your server directory structure.

  1. Set Cron Job to run every 5 minutes.

  2. Delete the database file: (directory-structure)/public_html/mautic/app/cache/ip_data/GeoLite2-City.mmdb.

  3. Let the Cron job run.

  4. Check the resulting Cron Job notification email to ensure that the database downloaded and extracted from .gz to .mmdb

  5. Check that the database file was created: (directory-structure)/public_html/mautic/app/cache/ip_data/GeoLite2-City.mmdb.

Note: The database file may have the same creation date as the original you deleted. The file date will change monthly as new .mmdb files are created by MaxMind.

  1. Add the suffix to the right end of the Cron Job to suppress error logs.
>/dev/null 2>&1
  1. Change Cron Job to run sometime after the first Tuesday of each month. This is to reflect MaxMinds, database updates on the first Tuesday of each month.

Note: The current database in your file structure is overwritten each time the Cron Job runs. No additonal files are created and the .gz file is removed as well. Once the Cron Job is running no additional maitenance is required. Just let it run, occasionally checking that the date of the file is updated to reflect that month’s database update.

Cron Job, Final Command Line string:

(directory-structure)/update-maxmind-database >/dev/null 2>&1

CraigM

I am getting stuck on Step 3 of the Getting Started page. I am not able to find the option to download the GeoLite2-City database (https://www.mautic.org/docs/setup/getting_started.html).

When I look in the mautic_prod-2016-04-09.php log file I see this error:

[2016-04-09 19:24:39] mautic.WARNING: IP LOOKUP: The file “/home1/username/public_html/mautic/app/cache/prod/…/ip_data/GeoLite2-City.mmdb” does not exist or is not readable. [] []

The Getting Started page directs you to " On the System Settings tab, find the IP lookup service option and click the “Fetch IP Lookup Data Store.”".

The “Ip lookup service” options, when the drop down is opened, extends past the edge of my monitor and I cannot see any “Fetch” options. When I scroll within the opened drop box, no fetch options are revealed.

When I search the server for the “ip-data” path as indicated in the error log it is not present on my shared server.

Has the installation process changed?

If I download the database from MaxMind.com what is the correct path. The path in the log file is truncated (prod/…/ip_data/)

I know this is basic, but darn I am searching, reading and exploring the forums looking for answers. I’m failing but it is not for a lack of trying.

Your comments will be welcomed.

CraigM

I stand corrected, I found the ip_data directory located at: /public_html/mautic/app/cache/ip_data

I downloaded the GeoLite2 City database from: http://dev.maxmind.com/geoip/geoip2/geolite2/

I then extracted the mmdb file and copied it to the ip_data directory.

I logged out and back into Mautic. My Cron Jobs have run with no further entries into the logs.

MaxMind has a complicated automatic update install that is beyond me at http://dev.maxmind.com/geoip/geoipupdate/

Any Ideas how to get the auto update function to work?

Thanks, CraigM

Has anyone else run into a problem using wget to download the updated maxmind database file? When I try it, I get this error:

ERROR 503:  Service Temporarily Unavailable.

But it works fine when I browse to that url in a regular browser. I think I need to setup wget to use a proxy server, but I don’t have a proxy server. I looked a little while to see if there was a free proxy server I could use for the /etc/wgetrc file, but no luck.

Hi guys, I just published a post about how to fix the MaxMind Geolite2 database in 2020:

1 Like

Thanks so much Yosu. This is exactly what I am looking for. I stuck with this issues for a couple weeks now. Especially, the last note is very important, do NOT press the button to update!!! :blush:

Take a look at this PR which just came in: https://github.com/mautic/mautic/pull/8337 (please test if you are able - I’ve asked for more detailed test instructions)

1 Like

I just merged https://github.com/mautic/mautic/pull/8337 into the staging branch, which means this PR will make it into Mautic 2.16 (expected beta release on Jan 30). This is a short term fix which maintains current Maxmind behavior. For long term consideration, please read my comment on the PR: https://github.com/mautic/mautic/pull/8337#issuecomment-578953976

2 Likes

@dennisameling what do you mean with:

@Yosu_Cadilla by “short term” I mean that it’s a quick fix that allows us to make tests in the Mautic staging branch pass again (as mentioned in the PR), so that we can work towards the 2.16 release. By “current Maxmind behavior” I mean that the functionality to activate IP lookup in Mautic won’t change, so users can just activate Maxmind via the GUI without having to install additional dependencies/tools :slight_smile:

Got it, thank you for the clarification.

Hi,

How do I solve this error?
/usr/local/cpanel/bin/jailshell: -c: line 0: syntax error near unexpected token /update-maxmind-database' /usr/local/cpanel/bin/jailshell: -c: line 0: (/home2/deejays)/update-maxmind-database’

Hi,
Now I am getting this error message? I took of the parenthesis

/bin/sh: /home2/deejays/update-maxmind-database: No such file or directory

@Yosu_Cadilla I am getting this error at step 4

Using config file /etc/GeoIP.conf

Using database directory /usr/share/GeoIP

Performing get filename request to https://updates.maxmind.com/app/update_getfilename?product_id=GeoLite2-ASN

error retrieving updates: error creating database writer: error acquiring a lock: open /usr/share/GeoIP/.geoipupdate.lock: permission denied

Can anyone help me to fix this issue?

Opened an maxmind account, got key, authenticated and dowloaded through Mautic system settings.

Have 1, maybe stupid, question: should i leave my geolite2 update cronjob?