This is a text-only version of the following page on https://raymii.org:
---
Title       : 	ntop-ng 1.1 installation on Ubuntu 12.04
Author      : 	Remy van Elst
Date        : 	29-11-2013
URL         : 	https://raymii.org/s/tutorials/ntop-ng-installation-on-Ubuntu.html
Format      : 	Markdown/HTML
---



### Screenshots

This is a guide on installing the latest ntop-ng (1.1) on Ubuntu 12.04.

    
    
    ntopng is the next generation version of the original ntop, a network traffic probe that shows the network usage, similar to what the popular top Unix command does. ntop is based on libpcap and it has been written in a portable way in order to virtually run on every Unix platform, MacOSX and on Win32 as well. ntopng users can use a a web browser to navigate through ntop (that acts as a web server) traffic information and get a dump of the network status. In the latter case, ntop can be seen as a simple RMON-like agent with an embedded web interface. 
    

This tutorial will walk you through the compilation and installation of ntopng
from source. The package in the Ubuntu 12.04 repositories it quite old.

<p class="ad"> <b>Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below:</b><br><br> <a href="https://leafnode.nl">I'm developing an open source monitoring app called  Leaf Node Monitoring, for windows, linux & android. Go check it out!</a><br><br> <a href="https://github.com/sponsors/RaymiiOrg/">Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.</a><br><br> <a href="https://www.digitalocean.com/?refcode=7435ae6b8212">You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days. </a><br><br> </p>


[![ntop][2]][2]

[![ntop][3]][3]

[![ntop][4]][4]

[![ntop][5]][5]

[![ntop][6]][6]

### What can ntopng do?

  * Sort network traffic according to many protocols
  * Show network traffic and IPv4/v6 active hosts
  * Store on disk persistent traffic statistics in RRD format
  * Geolocate hosts
  * Discover application protocols by leveraging on nDPI, ntops DPI framework.
  * Characterise HTTP traffic by leveraging on characterisation services provided by block.si. 
  * Show IP traffic distribution among the various protocols
  * Analyse IP traffic and sort it according to the source/destination
  * Display IP Traffic Subnet matrix (who is talking to who?)
  * Report IP protocol usage sorted by protocol type
  * Act as a NetFlow/sFlow collector for flows generated by routers (e.g. Cisco and Juniper) or switches (e.g. Foundry Networks) when used together with nProbe.
  * Produce HTML5/AJAX network traffic statistics

[More information on ntop-ng can be found on their website:
http://www.ntop.org/][7]

### Contents

This is what we are going to do:

  * Install required packages
  * Download files
  * Place ntopng-data
  * Compile ntopng
  * Create config file
  * Test ntopng
  * Place upstart script

Here's what you need:

  * Ubuntu 12.04 installation
  * Debian 7 also works

[This tutorial was tested on a DigitalOcean VPS. If you use this link you
sponsor this website. (referral link)][1]

### Note about checkinstall and packages

We are using checkinstall here to create a debian package of the source we
compile. I do this because it gives more flexibility in managing the software
afterwards. Upgrading or uninstalling the packages is easier than removing all
the things make install placed. Furthermore, it makes it more clear for other
administrators which software is installed.

If you for example want to upgrade ntop-ng when it was installed via this
tutorial with checkinstall, repeat the tutorial with only the version number
changed.

### Installing required packages

These are the packages we need to build and use for ntopng

    
    
     apt-get install libpcap-dev libglib2.0-dev libgeoip-dev redis-server wget libxml2-dev build-essential checkinstall
    

### Download the files

We need to download both the data files and the source code. You can download it [from sourceforge][8]:
    
    
    mkdir -p /usr/local/src
    cd /usr/local/src
    
    wget "http://downloads.sourceforge.net/project/ntop/ntopng/ntopng-data-1.1_6932.tgz" -O ntopng-data-1.1.tar.gz
    
    wget "http://downloads.sourceforge.net/project/ntop/ntopng/ntopng-1.1_6932.tgz" -O ntopng-1.1.tar.gz
    

### Place ntopng-data

The data files contain files for the web interface like the GeoIP database. They
are already good, the only thing we need to do is place them:

    
    
    cd /usr/local/src
    tar -xf ntopng-data-1.1.tar.gz
    cd ntopng-data-1.1_6932
    cp -r ./usr/* /usr 
    

### Compile ntopng

The compilation of ntopng itself is a bit more work, this is because the ntopng
1.1 package includes prebuilt .o blobs for third party tools, probably by
accident, which will cause you trouble when building ntopng yourself. We need to
clean those up.

First we extract:

    
    
    cd /usr/local/src
    tar -xf ntopng-1.1.tar.gz
    cd ntopng-1.1_6932
    

Then we configure:

    
    
    ./configure
    

Clean up:

    
    
    make clean
    
    cd third-party/json-c 
    make clean
    cd .. 
    
    cd third-party/LuaJIT-2.0.2
    make clean
    cd .. 
    
    cd third-party/rrdtool-1.4.7
    make clean
    cd ..
    
    cd third-party/zeromq-3.2.3
    make clean
    cd ..
    
    cd third-party/credis-0.2.3
    make clean
    cd ..
    

Start the actual compilation:

    
    
    make
    

And install the thing:

    
    
    checkinstall
    

The default answers for checkinstall are okay.

### Creating the ntopng config file

First we create the required folder:

    
    
    mkdir -p /etc/ntopng
    

There are two files needed. First is `/etc/ntopng/ntopng.start`:

    
    
    --local-networks "172.20.16.0/24"
    --interface 1
    

To see all available interfaces and options, use the `ntopng -h` option:

    
    
    Available interfaces (-i <interface index>):
       1. eth0
       2. vmbr0
       3. venet0
       [...]
       14. any
       15. lo
    

Then there is the `/etc/ntopng/ntopng.conf` file:

    
    
    -G=/var/run/ntopng.pid
    

Again, with the `ntopng -` option you can see all the possible options for use
in this config file.

Before starting the test, make sure redis is started:

    
    
    /etc/init.d/redis-server restart
    

### Test ntopng

If the compilation gave no errors and the config files are places we can start
`ntopng` and see how it works:

    
    
    ntopng /etc/ntopng/ntopng.conf
    

Use your web browser to navigate to `http://your-ntop-box-ip:3000`. There you
can login with the username/password combo `admin/admin`.

If this works, and there is data visible as in the screenshots, continue on to
set up the upstart script.

### Upstart script

This is a simple upstart script which can be used to start, stop and restart
ntopng. Place it in `/etc/init/ntopng.conf`:

    
    
    # ntopng network flow analyzer
    # by https://raymii.org
    
    description     "ntopng network flow analyzer"
    
    start on virtual-filesystems
    stop on runlevel [06]
    
    respawn
    respawn limit 5 30
    limit nofile 65550 65550
    
    setuid root
    setgid root
    console log
    
    script
            exec /usr/local/bin/ntopng /etc/ntopng/ntopng.conf
    end script
    

   [1]: https://www.digitalocean.com/?refcode=7435ae6b8212
   [2]: https://raymii.org/s/inc/img/ntopng/1.png
   [3]: https://raymii.org/s/inc/img/ntopng/2.png
   [4]: https://raymii.org/s/inc/img/ntopng/3.png
   [5]: https://raymii.org/s/inc/img/ntopng/4.png
   [6]: https://raymii.org/s/inc/img/ntopng/5.png
   [7]: http://www.ntop.org/
   [8]: http://sourceforge.net/projects/ntop/files/ntopng/

---

License:
All the text on this website is free as in freedom unless stated otherwise. 
This means you can use it in any way you want, you can copy it, change it 
the way you like and republish it, as long as you release the (modified) 
content under the same license to give others the same freedoms you've got 
and place my name and a link to this site with the article as source.

This site uses Google Analytics for statistics and Google Adwords for 
advertisements. You are tracked and Google knows everything about you. 
Use an adblocker like ublock-origin if you don't want it.

All the code on this website is licensed under the GNU GPL v3 license 
unless already licensed under a license which does not allows this form 
of licensing or if another license is stated on that page / in that software:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Just to be clear, the information on this website is for meant for educational 
purposes and you use it at your own risk. I do not take responsibility if you 
screw something up. Use common sense, do not 'rm -rf /' as root for example. 
If you have any questions then do not hesitate to contact me.

See https://raymii.org/s/static/About.html for details.