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
yumwithaptin package management commands.
Steps:
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
Set Up CPAN:
Initialize and install CPAN. This is required as the GeoIP build scripts are written in Perl.
cpan install
Install Required CPAN Modules:
Install the necessary Perl modules for the
xt_geoip_buildscript:cpan Text::CSV Text::CSV_XS Net::CIDR::Lite
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
Configure the Build:
Edit the
mconfigfile to select the modules you need. For instance, to build only the geoip module, comment out other modules and ensurebuild_geoip=mis active.
Build and Install:
Compile and install the selected xtables-addon modules:
./configure && make && make install