- Howto install Nginx on Centos 6.3 or Redhat 6.3 RHEL, Howto install Nginx Web Server on Centos 6.3 or Redhat 6.3 RHEL.
- Xtables-Addons On Centos 6 & Iptables GeoIP Filtering. This tutorial will explain how to install aditional modules for the kernel to use with iptables rules sets (netfilter modules). Xtables-addons is the successor to patch-o-matic(-ng). Likewise, it contains extensions that were not, or are not yet, accepted in the main kernel/iptables packages.
- How To Install Geoip On Centos 6 Vs Centos Server
- Install Mysql On Centos 6
- Configuring Nfs Server On Centos 6
Mod_GeoIP is an Apache module that can be used to get the geographic location of IP address of the visitor into the Apache web server. This module allows you to determine the visitor’s country, organization and location. It is specially useful for Geo Ad Serving, Target Content, Spam Fighting, Fraud Detection, Redirecting/Blocking visitors based on their country and much more.
How to Install and Use GeoIP on Fedora, CentOS, Ubuntu June 05 2015 geoiplookup command is to get the Country that an IP address or Hostname use the GeoIP library and database. Howto install GeoIP or libGeoIP.so on Centos or Redhat RHEL, Guide to install GeoIP or libGeoIP.so on Centos or Redhat RHEL.
GeoIP module allows system administrators to redirect or block web traffic according on the client geographical location. The geographical location is learned via client IP address.
Mod_GeoIP has two different version one is Free and another one is Paid and uses MaxMind GeoIP / GeoCity databases.
- Free Version : In Free version the Geo City and Country databases are availble with 99.5% accuracy.
- Paid Version : In Paid version you will get both databases with 99.8% accuracy with some more advanaced details about IP address.
If you like to check out the more differences betweetn Free and Paid version, please visit the Maxmind.com.
This article explains how to setup and install Mod_GeoIP module for Apache in RHEL and CentOS using EPEL repository with YUM package manager utility.
We assume that you already have running RHEL and CentOS system with a working LAMP (Linux, Apache, MySQL and PHP) setup. If not, then read our articles where we’ve shown the installation of both operating systems with LAMP.
Installation Of RHEL/CentOS
LAMP Setup on RHEL/CentOS
Enable EPEL Repository in RHEL and CentOS
By default mod_Geoip is not avilable under RHEL / CentOS official repository, so we need to install and enable third party EPEL repository.
Install Mod_GeoIP in RHEL and CentOS
Once you’ve EPEL repository enabled on your system, you can simple install mod_geoip by running following command with their dependency packages.
Download latest Geo City and Country Database
It’s good idea to download latest Geo City and Country Database to stay updated.
Enable Mod_GeoIP in Apache
After the module has been installed, open and edit the module main configuration file, with a command line text editor such as vi, and activate the module server-wide, as illustrated in the below excerpt.
Set the line GeoIPEnable from Off to On. Also, make sure you add the absolute path to GeoIP database file.
Restart the Apache service to reflect changes.
![How To Install Geoip On Centos 6 Vs Centos How To Install Geoip On Centos 6 Vs Centos](https://i.ytimg.com/vi/Xnjrp62M35I/hqdefault.jpg)
![How to install webmin on centos 6 How to install webmin on centos 6](https://i.ytimg.com/vi/egT47t_6uwA/hqdefault.jpg)
However, it’s not recommended to turn on GeoIP module server-wide. You should enable the GeoIP module only in
<Location>
or <Directory>
blocks where you would actually perform the traffic redirection or block. Testing Mod_GeoIP Module
To test the mod_geoip module is working correctly with Apache, we need to creat a PHP file called testgeoip.php under Apache root directory (e.g. /var/www/html).
Insert the following piece of php code to it.
Now, try to call the file using web browser (e.g. http://localhost/testgeoip.php). You will get your IP address and Country details.
Updating GeoIP Database
GeoIP database is updated beginning of every month. So, its is very important to keep GeoIP database up-to-date. To download latest version of database use the following command.
Automatic GeoIP Database Update
We have written a smaill shell script that will automatically download the latest version of GeoIP database every month. Just place the any of the following script under /etc/cron.monthly.
Script 1
Script 2
Redirecting Users based on Country
The below example code will redirect users based on the country code that we set to AS (Asia). This way you can redirect any users based on their county code.
Blocking Users based on Country
This example will block users based on the country code that GeoIP sets. Below example will block users from AS (Asia) and US (United States) countries.
How To Install Geoip On Centos 6 Vs Centos Server
Allowing Users based on Country
This below example will only allow users from below mentioned countries.
Install Mysql On Centos 6
For more information about mod_geoip and its usage can be found at http://www.maxmind.com/app/mod_geoip. If you’re having any trouble in setting up mod_geoip module, please let us know via comments and please don’t forget to share it with your friends.
Configuring Nfs Server On Centos 6
Share