Installing mod_geoip2 Apache module

Actually this is not a post on PHP but yeah Many times you happen to come across a situation where you need to compile and install Apache modules while writing PHP applications. This is one of my condition I came along. Here I am working for a multinational company which sells it products all over the world and they've this pretty nice thing to set-up in their website. They redirect their users to their countries own domain. For example google.com will be redirected to google.com.au if the visitors geographical location is australia.

So, for such a case, we are going to use MaxMind's API. So before we could do that we need to install an Apache module. This post is basically on the installation of this modules.

Well I am on fedora 18 for now while I am writing this post and doing the installation. First thing I believe is you definitely have been to this page http://dev.maxmind.com/geoip/mod_geoip2 . Here's all the stuffs described. Okey so lets download the files: First file to download is http://www.maxmind.com/download/geoip/api/c/GeoIP-latest.tar.gz . Once the file is downloaded you can use the following commands to compile it:

1. $tar -xvzf GeoIP-latest.tar.gz
this commands extracts the files in a folder for my case its GeoIP-1.5.0
2. $cd GeoIP-1.5.0
change the directory to the source directory
3. $./configure
does all the configuration
4. $make
compiles the code
5. $make check
checks if the compilation was successful. you'll see test passed for successful compilation, else errors will be displayed
6. $sudo make  install
does the installation 
7. $make installcheck
checks for successful installation
8. $make clean
removes all the compiled binaries from the source folder


Once this installation is done, the next step is to download: 
Now for the installation of this you need to do is:
1 $tar -xvzf mod_geoip2-latest-tar.gz
2. $cd mod_geoip2_1.2.8
3. apxs -i -a -L /usr/local/lib -I /usr/local/include -lGeoIP -c mod_geoip.c
 

During the installation you might come through several dependency problem:
If you come across a problem like: 
-> configure: error: Zlib header (zlib.h) not found.You may need to install a zlib development package
Then your solution is : sudo  yum install  zlib zlib-dev

Also its better to install httpd development package and you can do that by: 
sudo yum install httpd-devel

So you have successfully compiled an Apache module. Cheers!!!
Now you can do rest of the stuffs as defined in the first link we discussed about. Why no start downloading the database files???

Comments

Popular posts from this blog

Automate file upload in Selenium IDE

How To Install and Configure Nextcloud