vnStat and vnstat PHP Frontend Installation – CentOS

Yum installation

yum install vnstat

Edit configuration

vim /etc/sysconfig/vnstat

I only have one interface (eth0), you may have more (eth1 etc…)

# see also: vnstat(1)
# starting with vnstat-1.6 vnstat can also be
# configured via /etc/vnstat.conf
# the following sets vnstat up to monitor eth0
VNSTAT_OPTIONS="-u -i eth0"

Edit configuration

vim /etc/vnstat.conf

Set your default interface

# default interface
Interface "eth0"

Setup your database

vnstat -u -i eth0

Start vnStat service

chkconfig vnstat on

Other commands for vnStat

service vnstat start
service vnstat stop
service vnstat restart
service vnstat status

Check if installation has been successful

vnstat -i eth0

Run –help for more commands

vnstat --help

Now install php front end.
Install these if not already installed

yum install httpd php php-gd

Go to the directory you want to install the frontend. i.e.

# make directory
mkdir /home/domain/public_html/vnstat
# change to directory
cd /home/domain/public_html/vnstat
# download frontend files
# untar file
tar xvf vnstat_php_frontend-1.5.1.tar.gz
# delete tar file
rm -f vnstat_php_frontend-1.5.1.tar.gz

Configure vnStat php frontend

vim /home/domain/public_html/vnstat/config.php

Look for the following Strings and edit them

$language = 'en';
$iface_list = array('eth0');
$iface_title['eth0'] = 'Internal';

Check if frontend has been installed correctly

If you get the following error:

This page contains the following errors:

error on line 10 at column 10: error parsing attribute name
Below is a rendering of the page up to the first error.

Edit your config.php file

vim /home/domain/public_html/vnstat/config.php

Look for

// graphics format to use: svg or png

Replace svg with png

// graphics format to use: svg or png

Join the conversation


  1. Another way to solve the ‘error on line 10 column 10’ issue is to install PHP’s GD library.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.