How To Install vnstat on CentOS 8

vnstat is Console-based network traffic monitor

Introduction

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

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 8. In this tutorial we discuss both methods but you only need to choose one of method to install vnstat.

Install vnstat on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

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

sudo dnf -y install vnstat

Install vnstat on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

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

sudo yum -y install vnstat

How To Uninstall vnstat on CentOS 8

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

sudo dnf remove vnstat

vnstat Package Contents on CentOS 8

/etc/vnstat.conf
/run/vnstat
/usr/bin/vnstat
/usr/bin/vnstati
/usr/lib/.build-id
/usr/lib/.build-id/41
/usr/lib/.build-id/41/5bb13559f0515e1a3c9fd1f0d76595959149e9
/usr/lib/.build-id/84
/usr/lib/.build-id/84/ee29b5d516e40f7fc6a042f89c32327c0c063a
/usr/lib/.build-id/cd
/usr/lib/.build-id/cd/10f1fa422fb7731de9cb83fb41ea3c6b0f5395
/usr/lib/systemd/system/vnstat.service
/usr/lib/tmpfiles.d/vnstat.conf
/usr/sbin/vnstatd
/usr/share/doc/vnstat
/usr/share/doc/vnstat/CHANGES
/usr/share/doc/vnstat/FAQ
/usr/share/doc/vnstat/INSTALL
/usr/share/doc/vnstat/README
/usr/share/doc/vnstat/examples
/usr/share/doc/vnstat/examples/vnstat-json.cgi
/usr/share/doc/vnstat/examples/vnstat-json.php
/usr/share/doc/vnstat/examples/vnstat.cgi
/usr/share/licenses/vnstat
/usr/share/licenses/vnstat/COPYING
/usr/share/man/man1/vnstat.1.gz
/usr/share/man/man1/vnstati.1.gz
/usr/share/man/man5/vnstat.conf.5.gz
/usr/share/man/man8/vnstatd.8.gz
/var/lib/vnstat

References

Summary

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