Thursday, May 16, 2019

How to install GeoLite2 and mod_maxminddb for Apache 2 on Centos 6, 7 with SeLinux enabled

As GeoLite Legacy databases were discontinued on January 2, 2019, your new option is to use  MaxMind's GeoLite2 Free Downloadable Databases. Currently there is no available rpm package to install mod_maxminddb easily for Apache 2.2 on Centos 6 with SeLinux enabled. So, here are the necessary steps to achive it.

Install pre-requisites:
# yum groupinstall 'Development Tools'
# yum install tar gzip wget httpd-devel
Download and decompress current free GeoLite2 IP country database from website. (You may need to modify the last command line according to the current file name!)

UPDATE on 2020 spring:
Due to new data privacy regulations, there were significant changes to how to access free GeoLite2 databases starting December 30, 2019. Since then, it requires a free registration to download the GeoLite2 databases. See the instructions at for obtainig the userID and LicenceKey.
After registration you will get personalized permanent links to download the GeoLite2 databases. It requires quite long time that new licence key becomes effective, so you may need to download the GeoLite2-country database from the website in browser instead of wget command.
$ mkdir -p /usr/share/GeoIP
$ cd /tmp
$ wget
$ tar xvzf GeoLite2-Country.tar.gz
# cp GeoLite2-Country_20200314/GeoLite2-Country.mmdb /usr/share/GeoIP/
Obtaining the latest up-to-date IP database, you may also install a package from Epel repository:
$ yum -y install geoipupdate
$ geoipupdate -v
geoipupdate requires you to put your previously mentioned LicenceKey and userId into /etc/GeoIp.conf
geoipupdate downloads, decompress and install the latest IP databases for you from MaxMind website.
Because IP data are always changing it is a good idea to update your local IP data periodically by running geoipupdate in a cron job on monthly bases. (Currently the GeoLite2 Country and City databases are updated on the first Tuesday of each month.) Put the followings into your crontab file to run on IP updating on each wednesday at noon:
0 12 * * 3 /usr/bin/geoipupdate
To have more info about geoipupdate config options run man geoipupdate.

Next step is to install libmaxminddb. On their github page there is a detailed description about installation. The current release is the version 1.4.2, but I have tested the older version 1.3.2 also.
$ wget
$ tar xvzf libmaxminddb-1.4.2.tar.gz
$ cd libmaxminddb-1.4.2
$ ./configure
$ make
$ make check
# make install
# ldconfig
The newly created file is installed into /usr/local/lib folder. By default this folder is not in ld search path in Centos 6, so check it if this folder is in it:
$ ldconfig -v | grep -e ""
If the output does not contain  the desired line, create a new ld config file having this folder in it:
# echo "/usr/local/lib" >> /etc/
# ldconfig
If you have Epel repo installed there is an easier way because the following will also install libmaxminddb, but an older version:
# yum -y install libmaxminddb-devel
Next step is to install mod_maxminddb. On their github page there is a detailed description about installation. The current version is 1.2.0 but I have successfully tested version 1.1.0 also.
$ wget
$ tar xvzf mod_maxminddb-1.2.0.tar.gz
$ cd mod_maxminddb-1.2.0
$ ./configure
$ make
# make install
# chcon --reference /usr/lib64/httpd/modules/ /usr/lib64/httpd/modules/
Check if installer puts the following line into your httpd.conf:
LoadModule maxminddb_module /usr/lib64/httpd/modules/
Because this is the default directory for modules you may abbreviate it to
LoadModule maxminddb_module modules/
To have the well-known GEOIP_COUNTRY_CODE environment variable containing the 2 letter ISO country codes put the followings into the httpd.conf:
MaxMindDBEnable On
MaxMindDBFile DB /usr/share/GeoIP/GeoLite2-Country.mmdb
MaxMindDBEnv GEOIP_COUNTRY_CODE DB/country/iso_code
Check the apache httpd config syntax by:
$ httpd -t
If everything is well done, reload the current apache httpd configuration:
# service httpd reload


  1. This information is meaningful and magnificent which you have shared here about the air conditioner repair . I am impressed by the details that you have shared in this post and It reveals how nicely you understand this subject. I would like to thanks for sharing this article here.air conditioner repair dubai

  2. The King Casino: Review & Bonus -
    Find out why we're so impressed with The 메리트카지노 King casino. From bonuses to games and promotions, you've never been to 10bet a 더킹카지노 land-based casino.

  3. Blackjack, the Casino in CT - Dr.MCD
    Blackjack, the 삼척 출장안마 Casino in CT, 울산광역 출장샵 is one of the most exciting table games in 경기도 출장마사지 Las Vegas. The dealer offers blackjack, and it has 통영 출장샵 an RTP of 95.8% which is 대전광역 출장샵

  4. Harrah's Casino & Hotel - MapYRO
    Find Harrah's Casino 나주 출장안마 & Hotel, Las 군산 출장마사지 Vegas, NV, 동해 출장안마 United States - MapYRO real-time 영주 출장안마 prices, Harrah's 여주 출장안마 Hotel and Casino, Las Vegas.

  5. The casino casino hotel at Harrah's and the LINQ - Air Jordan
    The casino hotel at Harrah's and the where can i buy air jordan 18 retro men blue LINQ bestest air jordan 18 retro Hotel in Las Vegas is the most beautiful place to be if buy air jordan 18 retro men you're going to visit the action at real air jordan 18 retro men red the show air jordan 18 retro racer blue

  6. The the rest is mapped to a certain image that is bodily distributed among the many variety of slots the reel incorporates. A digital illustration of this mapping using a set worth of bet365 128 and a reel with 22 slots may be be} seen in Fig. You can enjoy classic slot video games like “Crazy train” or Linked Jackpot video games like “Vegas Cash”.