How To Install GeoIP on CentOS 8

GeoIP is Library for country/city/organization to IP address or hostname mapping

Introduction

In this tutorial we learn how to install GeoIP on CentOS 8.

What is GeoIP

GeoIP is a C library that enables the user to find the country that any IP address or hostname originates from. It uses file based databases that can optionally be updated on a weekly basis by installing the geoipupdate-cron (IPv4) and/or geoipupdate-cron6 (IPv6) packages.

We can use yum or dnf to install GeoIP on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install GeoIP.

Install GeoIP on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install GeoIP using dnf by running the following command:

sudo dnf -y install GeoIP

Install GeoIP on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install GeoIP using yum by running the following command:

sudo yum -y install GeoIP

How To Uninstall GeoIP on CentOS 8

To uninstall only the GeoIP package we can use the following command:

sudo dnf remove GeoIP

GeoIP Package Contents on CentOS 8

/usr/bin/geoiplookup
/usr/bin/geoiplookup6
/usr/lib/.build-id
/usr/lib/.build-id/0b
/usr/lib/.build-id/0b/6ae01401fadaccf2389a3ddb2fe9310d7f6f50
/usr/lib/.build-id/83
/usr/lib/.build-id/83/2f645cfa96f0edb61f2fe656c3d71507ecae22
/usr/lib/.build-id/b8
/usr/lib/.build-id/b8/fa7a265577f72e7d26522d8d21421b45dc9453
/usr/lib64/libGeoIP.so.1
/usr/lib64/libGeoIP.so.1.6.12
/usr/share/doc/GeoIP
/usr/share/doc/GeoIP/AUTHORS
/usr/share/doc/GeoIP/ChangeLog
/usr/share/doc/GeoIP/NEWS.md
/usr/share/doc/GeoIP/README.md
/usr/share/licenses/GeoIP
/usr/share/licenses/GeoIP/COPYING
/usr/share/man/man1/geoiplookup.1.gz
/usr/share/man/man1/geoiplookup6.1.gz

References

Summary

In this tutorial we learn how to install GeoIP on CentOS 8 using yum and dnf.