If you need to install the excellent mod_geoip2 extension for Apache2 then it can be done fairly painlessly. First off, we need to make sure that we have gcc installed:
If you don’t have it then you could ‘yum install gcc’, but I prefer to install all development tools because they include gcc anyway:
Install the GeoIP development package
Install mod_geoip2 by fetching the latest version with wget. To check the latest version, take a look here first:
I’m installing 1.2.10 here with this, but replace the code in lines 1, 2 and 3 here with their latest version:
Now we use the apxs (Apache Extension Tool) to build our extension modules for Apache:
If you haven’t got apxs then you’ll need to install httpd-devel.
Be aware that this overwrites httpd so backup your server in case this fails or you get strange results.
If this fails with “Error: Nothing to do”, then it’s fairly common. You’ll probably find that /etc/yum.conf is blocking the installation. We can get around this by either editing the configuration file or typing:
You should now have mod_geoip2 installed on your server!