How to Install GeoIP on CentOS 6 When Standard Yum Commands Fail: A Developer’s Troubleshooting Guide


5 views

Many developers maintaining legacy CentOS 6 systems encounter the frustrating No package GeoIP available error when trying to install geo-location capabilities. This occurs because:

  • Default CentOS 6 repositories no longer maintain GeoIP packages
  • EPEL repository configurations often need manual intervention
  • Package dependencies have evolved since initial documentation was written

Here are three working approaches tested on CentOS 6.10 final release:

Method 1: Enable EPEL Repository

# First install EPEL
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

# Then install GeoIP packages
yum --enablerepo=epel install GeoIP GeoIP-devel GeoIP-data

Method 2: Manual RPM Installation

When EPEL isn't available, download and install manually:

wget https://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/g/GeoIP-1.6.12-5.el6.x86_64.rpm
wget https://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/g/GeoIP-devel-1.6.12-5.el6.x86_64.rpm
rpm -ivh GeoIP-*.rpm

Confirm successful installation with:

# Check installed version
geoiplookup -v

# Test with Google's IP
geoiplookup 8.8.8.8

# Expected output:
# GeoIP Country Edition: US, United States

Dependency failures: If you see missing libGeoIP.so.1 errors:

ln -s /usr/local/lib/libGeoIP.so.1 /usr/lib/libGeoIP.so.1
ldconfig

Database updates: GeoIP data becomes outdated quickly. Set up monthly updates:

# Add to crontab
0 3 1 * * /usr/bin/geoipupdate -v

Many developers encounter the frustrating "No package GeoIP available" error when trying to install GeoIP on CentOS 6 using the standard command:

yum install GeoIP GeoIP-devel GeoIP-data

CentOS 6 has reached End of Life (EOL) status, and many repositories containing these packages have been moved or archived. The standard yum repositories no longer maintain these packages.

Here are three reliable methods to get GeoIP working on CentOS 6:

Method 1: Using EPEL Archive

# First install the EPEL repository
wget https://archive.fedoraproject.org/pub/archive/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm

# Then install GeoIP
yum install GeoIP GeoIP-devel GeoIP-data

Method 2: Manual RPM Installation

# Download the required RPMs
wget https://archives.fedoraproject.org/pub/archive/epel/6/x86_64/Packages/g/GeoIP-1.4.8-1.el6.x86_64.rpm
wget https://archives.fedoraproject.org/pub/archive/epel/6/x86_64/Packages/g/GeoIP-devel-1.4.8-1.el6.x86_64.rpm
wget https://archives.fedoraproject.org/pub/archive/epel/6/x86_64/Packages/g/GeoIP-data-1.4.8-1.el6.x86_64.rpm

# Install them manually
rpm -Uvh GeoIP-*.rpm

Method 3: Compile from Source

# Install dependencies
yum install gcc make zlib-devel

# Download and compile
wget https://github.com/maxmind/geoip-api-c/releases/download/v1.6.12/GeoIP-1.6.12.tar.gz
tar xvfz GeoIP-1.6.12.tar.gz
cd GeoIP-1.6.12
./configure
make
make install

After successful installation, verify with:

geoiplookup 8.8.8.8

You should see output showing the country for Google's DNS server.

  • Consider upgrading to a supported CentOS version if possible
  • The GeoIP legacy databases are being phased out in favor of GeoIP2
  • For production systems, evaluate MaxMind's official GeoIP2 databases