如何安装 geoip 数据库 Ubuntu 22.04

在本教程中,我们学习如何安装 geoip-database Ubuntu 22.04。 geoip-database 是使用 GeoIP 库(国家数据库)的 IP 查找命令行工具

介绍

在本教程中我们学习如何安装 geoip-database 在 Ubuntu 22.04。

什么是 geoip-database

geoip 数据库是:

GeoIP 是一个 C 库,使用户能够找到任何 IP 地址或主机名的来源国家/地区。 它使用基于文件的数据库。

该数据库仅包含 IP 块作为键,国家/地区作为值,它应该比使用反向 DNS 查找更完整和准确。

该软件包包含免费的 GeoLiteCountry 数据库。

有三种安装方法 geoip-database 在 Ubuntu 22.04。 我们可以用 apt-get, aptaptitude。 在以下部分中,我们将描述每种方法。 您可以选择其中之一。

使用 apt-get 安装 geoip-database

更新 apt 数据库 apt-get 使用以下命令。

更新apt数据库后,我们可以安装 geoip-database 使用 apt-get 通过运行以下命令:

sudo apt-get -y install geoip-database

使用 apt 安装 geoip-database

更新 apt 数据库 apt 使用以下命令。

更新apt数据库后,我们可以安装 geoip-database 使用 apt 通过运行以下命令:

sudo apt -y install geoip-database

使用 aptitude 安装 geoip-database

如果您想遵循此方法,您可能需要先安装 aptitude,因为 aptitude 通常不会默认安装 Ubuntu。 更新 apt 数据库 aptitude 使用以下命令。

更新apt数据库后,我们可以安装 geoip-database 使用 aptitude 通过运行以下命令:

sudo aptitude -y install geoip-database

如何卸载 geoip-database Ubuntu 22.04

仅卸载 geoip-database 打包我们可以使用以下命令:

sudo apt-get remove geoip-database

卸载 geoip-database 及其依赖项

卸载 geoip-database 及其不再需要的依赖项 Ubuntu 22.04,我们可以使用以下命令:

sudo apt-get -y autoremove geoip-database

删除 geoip-database 配置和数据

去除 geoip-database 配置和数据来自 Ubuntu 22.04我们可以使用以下命令:

sudo apt-get -y purge geoip-database

删除 geoip-database 配置、数据及其所有依赖项

我们可以使用下面的命令来删除 geoip-database 配置、数据及其所有依赖项,我们可以使用以下命令:

sudo apt-get -y autoremove --purge geoip-database

参考

概括

在本教程中我们学习如何安装 geoip-database 封装在 Ubuntu 22.04 使用不同的包管理工具: apt, apt-getaptitude