Install NS-3 (3.29) on Ubuntu 16.04 [*stable version]


Information:

NetAnim ==> works
PyViz virtualization ==> works
Python Bindings ==> works

Environment:

Ubuntu 16.04 could be installed on primary PC or VM

Pre-Install:

$ sudo apt update
$ sudo apt upgrade

Install dependency packages for NS-3.29:

$ sudo apt install gcc g++ python python-dev
$ sudo apt install mercurial python-setuptools git
$ sudo apt install qt5-default
$ sudo apt install gir1.2-goocanvas-2.0 python-gi python-gi-cairo
$ python-pygraphviz python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython ipython3
$ sudo apt install openmpi-bin openmpi-common openmpi-doc libopenmpi-dev
$ sudo apt install autoconf cvs bzr unrar
$ sudo apt install gdb valgrind
$ sudo apt install uncrustify
$ sudo apt install doxygen graphviz imagemagick
$ sudo apt install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils texlive-lang-portuguese dvipng
$ sudo apt install python-sphinx dia
$ sudo apt install gsl-bin libgsl2 libgsl-dev
$ sudo apt install flex bison libfl-dev
$ sudo apt install tcpdump
$ sudo apt install sqlite sqlite3 libsqlite3-dev
$ sudo apt install libxml2 libxml2-dev
$ sudo apt install cmake libc6-dev libc6-dev-i386 libclang-6.0-dev llvm-6.0-dev automake
$ pip install cxxfilt
$ sudo apt install libgtk2.0-0 libgtk2.0-dev
$ sudo apt install vtun lxc
$ sudo apt install libboost-signals-dev libboost-filesystem-dev

Clone the NS-3 packages:

$ mkdir workspace
$ cd workspace
$ hg clone http://code.nsnam.org/bake

Check whether the packages completely cloned:
$ cd bake
$ ls
It shows file/directory(s):
bake bakeconf.xml doc generate-binary.py test
TODO bake.py examples

Next steps:
Export BAKE_HOME='Pwd'
Export PATH=$PATH:$BAKE_HOME:$BAKE_HOME/Build/Bin
Export PYTHONPATH=$PYTHONPATH:$BAKE_HOME:$BAKE_HOME/Build/Lib

Download ns3 using bake:

$ ./bake.py configure -e ns-3.29
$ ./bake.py check
$ ./bake.py download

Check downloaded file/directory(s):

$ ls source
BRITE netanim-3.108 openflow-ns-3.25 pygccxml-1.9.1
castxml ns-3.29 pybindgen v1.9.1.tar.gz
click-ns-3.25 nsc-0.5.3 pygccxml

Run the test code to check if it works properly:

$ cd ns-allinone-3.29
$ ./test.py

Finally, run the ns3 sample script:

$ ./waf --run hello-simulator

If "Hello Simulator" is displayed, the installation of ns-3.29 is complete.