How to Install vnStat on Ubuntu 22.04

Install vnStat on Ubuntu 22.04

In this article, we will have explained the necessary steps to install vnStat on Ubuntu 22.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

vnStat is a console-based network traffic monitor that uses the network interface statistics provided by the kernel as an information source. With vnStat, you can monitor network statistics over various time periods. A network administrator generally uses it to monitor the bandwidth consumption with a minute-by-minute, hourly, daily, weekly, monthly, and yearly update.


  • Operating System with Ubuntu 22.04
  • Server IPv4 Address with Superuser Privileges (Root Access)
  • Gnome Terminal for Linux Desktop
  • PuTTy SSH client for Windows or macOS
  • Powershell for Windows 10/11
  • Familiar with APT Commands

Install vnStat on Ubuntu 22.04 LTS

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade
sudo apt install build-essential gcc make libsqlite3-dev apt-transport-https wget

Step 2. Install vnStat Monitoring Network Traffic on Ubuntu.

vnStat installation is quite easy and straightforward since the vnStat package is accessible in the repositories of the majority of Linux distributions. Now execute the following command to download the vnStat package for Ubuntu 22.04 LTS Jammy Jellyfish:


When the downloading is completed, extract the downloaded file with the following command:

tar -xvzf vnstat-2.10.tar.gz

Now, when you are in the vnStat directory, configure the files to get ready for installation:

cd vnstat-2.10
./configure --prefix=/usr --sysconfdir=/etc
make install

Once the vnStat installation is completed, Execute the following command on the command line to check its version:

vnstat -v

You should get the following output:

vnStat 2.10 by Teemu Toivola

Step 3. Configure Systemd VnStat Service.

First, copy the vnStat systemd service file from the vnStat source to the /etc/systemd/system/ directory:

cp -v vnstat-2.10/examples/systemd/vnstat.service /etc/systemd/system/

Next, enable the vnStat service and start it with the following command:

sudo systemctl enable vnstat
sudo systemctl start vnstat

Step 4. How to Monitor Network Traffic With vnStat.

vnStat provides several options that allow you to monitor the network traffic. You can list all available options with the following command:

vnstat --help


vnStat 2.10 by Teemu Toivola 

      -5,  --fiveminutes [limit]   show 5 minutes
      -h,  --hours [limit]         show hours
      -hg, --hoursgraph            show hours graph
      -d,  --days [limit]          show days
      -m,  --months [limit]        show months
      -y,  --years [limit]         show years
      -t,  --top [limit]           show top days

      -b, --begin            set list begin date
      -e, --end              set list end date

      --oneline [mode]             show simple parsable format
      --json [mode] [limit]        show database in json format
      --xml [mode] [limit]         show database in xml format

      -tr, --traffic [time]        calculate traffic
      -l,  --live [mode]           show transfer rate in real time
      -i,  --iface      select interface

Use "--longhelp" or "man vnstat" for complete list of options.

Before using vnStat, you will need to wait for some time to update the vnStat database. After updating the database, you can run vnStat without any option as shown below:


That’s all you need to do to install vnStat on Ubuntu 22.04 LTS Jammy Jellyfish. I hope you find this quick tip helpful. For further reading on the installation of the vnStat network traffic monitor, please refer to their official knowledge base. I hope this article was helpful to you. If you find it useful, don’t forget to share it with your friend and family. Also, if you have any questions, please feel free to ask in the comments section. We are always there to assist you.