How To Install python-geoip2 on Debian 9

In this tutorial we learn how to install python-geoip2 on Debian 9. python-geoip2 is Python geoip2 API for web services and databases - Python 2.x

Introduction

In this tutorial we learn how to install python-geoip2 on Debian 9.

What is python-geoip2

python-geoip2 is:

This package provides an API for the GeoIP2 web services and databases. The API also works with MaxMind??s free GeoLite2 databases.

This package contains the Python 2.x module.

There are three methods to install python-geoip2 on Debian 9. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-geoip2 Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-geoip2 using apt-get by running the following command:

sudo apt-get -y install python-geoip2

Install python-geoip2 Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python-geoip2 using apt by running the following command:

sudo apt -y install python-geoip2

Install python-geoip2 Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-geoip2 using aptitude by running the following command:

sudo aptitude -y install python-geoip2

How To Uninstall python-geoip2 on Debian 9

To uninstall only the python-geoip2 package we can use the following command:

sudo apt-get remove python-geoip2

Uninstall python-geoip2 And Its Dependencies

To uninstall python-geoip2 and its dependencies that are no longer needed by Debian 9, we can use the command below:

sudo apt-get -y autoremove python-geoip2

Remove python-geoip2 Configurations and Data

To remove python-geoip2 configuration and data from Debian 9 we can use the following command:

sudo apt-get -y purge python-geoip2

Remove python-geoip2 configuration, data, and all of its dependencies

We can use the following command to remove python-geoip2 configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-geoip2

Dependencies

python-geoip2 have the following dependencies:

References

Summary

In this tutorial we learn how to install python-geoip2 package on Debian 9 using different package management tools: apt, apt-get and aptitude.