环境:CentOS 6.5 64bit
PHP版本:5.3.3
1.安装GeoIP
[root@localhost ~]# yum install GeoIP GeoIP-devel GeoIP-data
但是安装失败:
[root@localhost ~]# yum install GeoIP GeoIP-devel GeoIP-data
Loaded plugins: auto-update-debuginfo, fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
No package GeoIP available.
No package GeoIP-devel available.
No package GeoIP-data available.
Error: Nothing to do
解决方法参考:
https://serverfault.com/questions/372978/installing-geoip-on-centos
安装epel,执行以下命令:
[root@localhost ~]# yum install epel-release
之后重新通过yum安装成功:
[root@localhost ~]# yum install GeoIP GeoIP-devel GeoIP-data
[root@localhost ~]# rpm -qi GeoIP
Name : GeoIP Relocations: (not relocatable)
Version : 1.6.5 Vendor: Fedora Project
Release : 1.el6 Build Date: Tue 14 Apr 2015 03:28:46 PM CST
Install Date: Tue 23 Jan 2018 05:06:19 PM CST Build Host: buildvm-09.phx2.fedoraproject.org
Group : Development/Libraries Source RPM: GeoIP-1.6.5-1.el6.src.rpm
Size : 317185 License: LGPLv2+
Signature : RSA/8, Tue 14 Apr 2015 11:16:45 PM CST, Key ID 3b49df2a0608b895
Packager : Fedora Project
URL : http://www.maxmind.com/app/c
Summary : Library for country/city/organization to IP address or hostname mapping
Description :
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.
[root@localhost ~]# rpm -ql GeoIP
/usr/bin/geoiplookup
/usr/bin/geoiplookup6
/usr/lib64/libGeoIP.so.1
/usr/lib64/libGeoIP.so.1.6.5
/usr/share/doc/GeoIP-1.6.5
/usr/share/doc/GeoIP-1.6.5/AUTHORS
/usr/share/doc/GeoIP-1.6.5/COPYING
/usr/share/doc/GeoIP-1.6.5/ChangeLog
/usr/share/doc/GeoIP-1.6.5/NEWS.md
/usr/share/doc/GeoIP-1.6.5/README.md
/usr/share/man/man1/geoiplookup.1.gz
/usr/share/man/man1/geoiplookup6.1.gz
[root@localhost ~]# rpm -qi GeoIP-devel
Name : GeoIP-devel Relocations: (not relocatable)
Version : 1.6.5 Vendor: Fedora Project
Release : 1.el6 Build Date: Tue 14 Apr 2015 03:28:46 PM CST
Install Date: Tue 23 Jan 2018 05:06:24 PM CST Build Host: buildvm-09.phx2.fedoraproject.org
Group : Development/Libraries Source RPM: GeoIP-1.6.5-1.el6.src.rpm
Size : 23331 License: LGPLv2+
Signature : RSA/8, Tue 14 Apr 2015 11:04:29 PM CST, Key ID 3b49df2a0608b895
Packager : Fedora Project
URL : http://www.maxmind.com/app/c
Summary : Development headers and libraries for GeoIP
Description :
Development headers and static libraries for building GeoIP-based applications.
[root@localhost ~]# rpm -ql GeoIP-devel
/usr/include/GeoIP.h
/usr/include/GeoIPCity.h
/usr/lib64/libGeoIP.so
/usr/lib64/pkgconfig/geoip.pc
关于epel的介绍:
http://fedoraproject.org/wiki/EPEL
https://jingyan.baidu.com/article/c843ea0baaf40477931e4a19.html
</