Install xtables-addons: GeoIP Blocking on Ubuntu 20.04 with iptables

Restrict firewall with geoip and iptables.

Update and install packages

sudo su
apt update && apt -y upgrade
apt install xtables-addons-common curl
apt install libtext-csv-xs-perl libmoosex-types-netaddr-ip-perl

Create folder

The shared library is hardcoded to look into this path!

mkdir /usr/share/xt_geoip

Make converter script executable

chmod +x /usr/lib/xtables-addons/xt_geoip_build

Install Perl module

cpan App::cpanminus
Appending installation info to /usr/lib/x86_64-linux-gnu/perl/5.30/perllocal.pod
  MIYAGAWA/App-cpanminus-1.7044.tar.gz
  make install  -- OK
cpanm Net::CIDR::Lite
--> Working on Net::CIDR::Lite
Fetching http://www.cpan.org/authors/id/D/DO/DOUGW/Net-CIDR-Lite-0.21.tar.gz ... OK
Configuring Net-CIDR-Lite-0.21 ... OK
Building and testing Net-CIDR-Lite-0.21 ... OK
Successfully installed Net-CIDR-Lite-0.21
1 distribution installed

See also

man xtables-addons