How To Install python-ipaddress on CentOS 7

In this tutorial we learn how to install python-ipaddress on CentOS 7. python-ipaddress is Port of the python 3.3+ ipaddress module to 2.6+

Introduction

In this tutorial we learn how to install python-ipaddress on CentOS 7.

What is python-ipaddress

ipaddress provides the capabilities to create, manipulate and operate on IPv4 and IPv6 addresses and networks. The functions and classes in this module make it straightforward to handle various tasks related to IP addresses, including checking whether or not two hosts are on the same subnet, iterating over all hosts in a particular subnet, checking whether or not a string represents a valid IP address or network definition, and so on.

We can use yum or dnf to install python-ipaddress on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install python-ipaddress.

Install python-ipaddress on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

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

sudo yum -y install python-ipaddress

Install python-ipaddress on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install python-ipaddress using dnf by running the following command:

sudo dnf -y install python-ipaddress

How To Uninstall python-ipaddress on CentOS 7

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

sudo dnf remove python-ipaddress

References

Summary

In this tutorial we learn how to install python-ipaddress on CentOS 7 using yum and dnf.