1. Bicom Systems
  2. Solution home
  3. SERVERware
  4. HOWTOs SERVERware 5

HOWTO :: Install GeoIP Module On AWS linux2

Note: Ensure you have root privileges when executing these commands. You can either switch to the root user using sudo -i or prepend sudo to each command.

Remember to periodically check for updates to the xtables-addons  to ensure you have the latest features and security patches.

Prerequisites:

  • A Linux-based system. This guide is based on Amazon Linux 2 on EC2, but it should be applicable to any CentOS/RHEL-based distribution. For Debian/Ubuntu-based systems, replace yum with apt in package management commands.

Steps:

  1. Set Up the Build Environment:

    Note: The following step may require some time to complete. Please be patient and allow it to finish.

    • Install the necessary packages. For CentOS/RHEL:

      yum install gcc gcc-c++ make automake unzip zip xz kernel-devel-`uname -r` iptables-devel cpan

      For Debian/Ubuntu:


      apt-get install gcc g++ make automake unzip zip xz-utils linux-headers-`uname -r` iptables-dev cpanminus
  2. Set Up CPAN:

    • Initialize and install CPAN. This is required as the GeoIP build scripts are written in Perl.

      cpan install
  3. Install Required CPAN Modules:

    • Install the necessary Perl modules for the xt_geoip_build script:

      cpan Text::CSV Text::CSV_XS Net::CIDR::Lite
  4. Download and Extract xtables-addons:

    • Fetch the latest xtables-addons build. Adjust the version number as needed.

      wget <https://inai.de/files/xtables-addons/xtables-addons-3.18.tar.xz> tar -xvf xtables-addons-3.18.tar.xz cd xtables-addons-3.18
  5. Configure the Build:

    • Edit the mconfig file to select the modules you need. For instance, to build only the geoip module, comment out other modules and ensure build_geoip=m is active.

  6. Build and Install:

    • Compile and install the selected xtables-addon modules:

      ./configure && make && make install