On CentOS, please follow procedure extracted from http://dev.maxmind.com/geoip/legacy/mod_geoip2/

(SCREEN):root@pul-lav-vp-conf-01:[~]# yum install httpd-devel GeoIP GeoIP-devel GeoIP-data zlib-devel 
(SCREEN):root@pul-lav-vp-conf-01:[~]# wget http://www.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2-latest.tar.gz
(SCREEN):root@pul-lav-vp-conf-01:[~]# tar xvzf mod_geoip2-latest.tar.gz
(SCREEN):root@pul-lav-vp-conf-01:[~]# cd mod_geoip2_1.2.8/
(SCREEN):root@pul-lav-vp-conf-01:[~/../mod_geoip2_1.2.8]# apxs -i -a -L/usr/lib -I/usr/include -lGeoIP -c mod_geoip.c

If it doens’t work because you have a GeoIP version not working or too old

(SCREEN):root@pul-lav-vp-conf-01:[~] wget http://www.maxmind.com/download/geoip/api/c/GeoIP-latest.tar.gz
(SCREEN):root@pul-lav-vp-conf-01:[~] tar xvzf GeoIP-latest.tar.gz
(SCREEN):root@pul-lav-vp-conf-01:[~] cd GeoIP-1.5.1
(SCREEN):root@pul-lav-vp-conf-01:[~/../mod_geoip2_1.2.8]# apxs -i -a -L/usr/lib -I/root/LIBGEOIP/GeoIP-1.5.1/libGeoIP -lGeoIP -c mod_geoip.c
...
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib/httpd/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
  - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
    during execution
  - add LIBDIR to the `LD_RUN_PATH' environment variable
    during linking
  - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
  - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/lib/httpd/modules/mod_geoip.so
[activating module `geoip' in /etc/httpd/conf/httpd.conf]