How To Install vnstat on CentOS 7

In this tutorial we learn how to install vnstat on CentOS 7. vnstat is Console-based network traffic monitor

Introduction

In this tutorial we learn how to install vnstat on CentOS 7.

What is vnstat

vnStat is a console-based network traffic monitor that keeps a log of daily network traffic for the selected interface(s). vnStat isn’t a packet sniffer. The traffic information is analyzed from the /proc file-system, so vnStat can be used without root permissions. See the web-page for few ‘screenshots’.

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

Install vnstat on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install vnstat using yum by running the following command:

sudo yum -y install vnstat

Install vnstat 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 vnstat using dnf by running the following command:

sudo dnf -y install vnstat

How To Uninstall vnstat on CentOS 7

To uninstall only the vnstat package we can use the following command:

sudo dnf remove vnstat

References

Summary

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