How to install vnStat on Ubuntu Linux Server

vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s).

It uses the network interface statistics provided by the kernel as an information source. This means that vnStat won’t actually be sniffing any traffic and also ensures light use of system resources.

Following this tutorial will guide you how you can install vnStat but before we proceed to our installation process make sure that you had installed LAMP stack.

1. Update all packages on your system by the below command.

sudo apt-get update

2. Use the below command to install “vnStat” package on your system.

sudo apt-get install vnstat

3. Once the installation is done, restart “vnStat” service and enable it, by the 2 below commands.

sudo systemctl start vnstat

sudo systemctl enable vnstat

4. You can use the below commands to show the statistics of your bandwidth by “vnState” on “Terminal”.

– To show statistics for day “vnstat -d”

– To show statistics for 1 month “vnstat -m”

– To show statistics for an hour “vnstat-h

– To show statistics for the current real-time “vnstat -l”

Configure vnStat PHP web based interface

vnStat also provides PHP based web interface to show graphical statistics. In order to set up vnStat web interface, it required install LAMP stack on Ubuntu 16.04, you can simply install LAMP.

1. Download “vnStat” PHP code by the using the command below on Terminal.

sudo wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz

2. Extract the downloaded archive in web accessible directory, you can do that by the command below.

tar xzf vnstat_php_frontend-1.5.1.tar.gz
mv vnstat_php_frontend-1.5.1 /var/www/html/

3. Open and Edit the file “config.php” to be like below.

4. Open your web browser and enter your local IP address to open “vnStat” web interface.

Congratulations! You have successfully installed and configured “vnStat”. Thanks for using our guide for installing VnStat network monitoring tool on.

Miguel

I started this tech blog back in 2011 as a place to write down processes I took to fix my client systems and network. Now I write some tips and tricks to help others with the tech issues that one might encounter.

You may also like...