Windows 上的 Ruby geoip_city
有没有办法让 geoip_city(Ruby gem)在 Windows 上运行?
Is there a way to get geoip_city, the Ruby gem, running on Windows?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否阅读过文档??我在那里找到了以下说明:
安装
以下内容的某些变体应该可以工作。
安装 GeoCity C 库。你可以从这里获取它 www.maxmind.com/app/c 例如,我喜欢将我的安装在 /opt/GeoIP 中,所以我这样做:
现在安装 geoip_city gem
从以下位置下载二进制格式的 GeoLite City 数据库文件:www.maxmind.com/app/geolitecity 也许这个直接链接会起作用:www.maxmind.com/download /geoip/database/GeoLiteCity.dat.gz 我将此文件放在 /opt/GeoIP/share/GeoIP/GeoLiteCity.dat
使用它!
在 Windows 上,gem 的安装方式与任何其他 gem 一样:
只需确保 ruby\bin 目录位于您的路径中,或者从 ruby\bin 目录运行上述命令。
但所需的 MaxMind 库和数据库需要做更多的工作。您将需要一个可以解压缩 tar.gz 文件的应用程序,例如 7zip。 MaxMind 库的链接特别提到存档中包含 Windows 安装说明。
数据库只是一个二进制文件,因此一旦解压缩它就可以开始了。
Have you read the documentation?? I found the following instructions there:
Install
Some variation of the following should work.
Install the GeoCity C library. You can get it from here www.maxmind.com/app/c For example, I like to install mine in /opt/GeoIP so I do this:
Now install the geoip_city gem
Download the GeoLite City database file in binary format from: www.maxmind.com/app/geolitecity Maybe this direct link will work: www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz I put this file in /opt/GeoIP/share/GeoIP/GeoLiteCity.dat
Use it!
On Windows, the gem installs like any other gem:
Just make sure that ruby\bin directory is in your path or you run the above command from the ruby\bin directory.
But the required MaxMind library and database takes a little more work. You will need an application that can uncompress tar.gz files such as 7zip. The link to the MaxMind library specifically mentions Windows installation instructions are contained in the archive.
The database is just a binary file, so once you've uncompressed it you're good to go.