Monday 5 May 2014

INSTALLING NS3 IN UBUNTU 12.10 AND ABOVE

 ns-3 is a network simulator for Internet systems, targeted primarily for research and educational use.You should install ns3 on any linux platform like ubuntu.If you want help about how to install ubuntu using pendrive you can refer to this link.

once ubuntu is installed run following command opening your terminal(ctrl+alt+T).

To install prerequisites-

sudo apt-get install gcc g++ python python-dev mercurial bzr gdb valgrind gsl-bin libgsl0-dev libgsl0ldbl flex bison tcpdump sqlite sqlite3 libsqlite3-dev libxml2 libxml2-dev libgtk2.0-0 libgtk2.0-dev uncrustify doxygen graphviz imagemagick texlive texlive-latex-extra texlive-generic-extra texlive-generic-recommended texinfo dia texlive texlive-latex-extra texlive-extra-utils texlive-generic-recommended texi2html python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev python-pygccxml 


 (now make sure you have not run sudo su to be superuser)
Downloading NS-3(ns-3 version 3.19 not 3.13)
   cd  
   mkdir ns3
   cd ns3
   wget http://www.nsnam.org/release/ns-allinone-3.19.tar.bz2
   tar xjf ns-allinone-3.19.tar.bz2
   cd ns-allinone-3.19/
   ls
 
 
Then you can find build.py along with other files.
Then to build the examples in ns-3 run 
 
   ./build.py --enable-examples --enable-tests
 
If the build is successful then it will give output
 "Build finished successfully".(clap for yourself)
 
 Now run the following command to configure with waf(build tool)
 
 ./waf -d debug --enable-examples --enable-tests configure

To build with waf(optional)
 
./waf
 
To test everything allright
 
./test.py
 
If the tests are ok the installation is done. :)
 

38 comments:

  1. Very use full ..thank you so much ....

    ReplyDelete
  2. thanks a lot..your tutorial very usefull, for the first time me successed the installation

    ReplyDelete
    Replies
    1. welcme okiteguh...thanx fr using blog....u can ask questns if any prblm....

      Delete
  3. is there any way to run ns3 on windows ??
    is ns3 for windows available????

    ReplyDelete
  4. Hi....when i try to install the prerequisites i encounter the following errors :
    E: Package 'python-dev' has no installation candidate
    E: Unable to locate package mercurial
    E: Unable to locate package bzr
    E: Unable to locate package valgrind
    E: Unable to locate package gsl-bin
    E: Unable to locate package libgsl0-dev
    E: Unable to locate package libgsl0ldbl
    E: Package 'flex' has no installation candidate
    E: Package 'bison' has no installation candidate
    E: Unable to locate package sqlite
    E: Unable to locate package sqlite3
    E: Unable to locate package libsqlite3-dev
    E: Unable to locate package libxml2-dev
    E: Unable to locate package libgtk2.0-dev
    E: Couldn't find any package by regex 'libgtk2.0-dev'
    E: Unable to locate package uncrustify
    E: Unable to locate package doxygen
    E: Package 'graphviz' has no installation candidate
    E: Package 'imagemagick' has no installation candidate
    E: Unable to locate package texlive
    E: Unable to locate package texlive-latex-extra
    E: Unable to locate package texlive-generic-extra
    E: Unable to locate package texlive-generic-recommended
    E: Package 'texinfo' has no installation candidate
    E: Unable to locate package dia
    E: Unable to locate package texlive
    E: Unable to locate package texlive-latex-extra
    E: Unable to locate package texlive-extra-utils
    E: Unable to locate package texlive-generic-recommended
    E: Unable to locate package texi2html
    E: Unable to locate package python-pygraphviz
    E: Unable to locate package python-kiwi
    E: Unable to locate package python-pygoocanvas
    E: Unable to locate package libgoocanvas-dev
    E: Unable to locate package python-pygccxml

    what should i do ?

    ReplyDelete
    Replies
    1. This happened with me too. It happens if ur thing is not rooted.
      Try "sudo -s" to root
      and then "apt -get update"

      If this doesn't help, refer these links:
      http://ubuntuforums.org/showthread.php?t=1853026

      http://askubuntu.com/questions/162879/how-to-fix-could-not-open-lock-file-because-permission-denied

      Delete
    2. Even after trying sudo -s to get to the root, i am getting the same erros as alin specified.

      The errors are

      Note, selecting 'rsyslog' instead of 'linux-kernel-log-daemon'
      Note, selecting 'pulseaudio' instead of 'pulseaudio-module-rygel-media-server'
      Note, selecting 'linux-image-3.5.0-17-generic' instead of 'linux-image'
      Note, selecting 'linux-image-3.5.0-17-generic' instead of 'linux-image-3.0'
      Note, selecting 'libgphoto2-port0' instead of 'libgphoto2port'
      Package python-dev is not available, but is referred to by another package.
      This may mean that the package is missing, has been obsoleted, or
      is only available from another source
      However the following packages replace it:
      python

      Package texinfo is not available, but is referred to by another package.
      This may mean that the package is missing, has been obsoleted, or
      is only available from another source
      However the following packages replace it:
      info install-info

      Package imagemagick is not available, but is referred to by another package.
      This may mean that the package is missing, has been obsoleted, or
      is only available from another source

      Package graphviz is not available, but is referred to by another package.
      This may mean that the package is missing, has been obsoleted, or
      is only available from another source

      Package flex is not available, but is referred to by another package.
      This may mean that the package is missing, has been obsoleted, or
      is only available from another source

      Package bison is not available, but is referred to by another package.
      This may mean that the package is missing, has been obsoleted, or
      is only available from another source

      E: Package 'python-dev' has no installation candidate
      E: Unable to locate package mercurial
      E: Unable to locate package bzr
      E: Unable to locate package valgrind
      E: Unable to locate package gsl-bin
      E: Unable to locate package libgsl0-dev
      E: Unable to locate package libgsl0ldbl
      E: Package 'flex' has no installation candidate
      E: Package 'bison' has no installation candidate
      E: Unable to locate package sqlite
      E: Unable to locate package sqlite3
      E: Unable to locate package libsqlite3-dev
      E: Unable to locate package libxml2-dev
      E: Unable to locate package libgtk2.0-dev
      E: Couldn't find any package by regex 'libgtk2.0-dev'
      E: Unable to locate package uncrustify
      E: Unable to locate package doxygen
      E: Package 'graphviz' has no installation candidate
      E: Package 'imagemagick' has no installation candidate
      E: Unable to locate package texlive
      E: Unable to locate package texlive-latex-extra
      E: Unable to locate package texlive-generic-extra
      E: Unable to locate package texlive-generic-recommended
      E: Package 'texinfo' has no installation candidate
      E: Unable to locate package dia
      E: Unable to locate package texlive
      E: Unable to locate package texlive-latex-extra
      E: Unable to locate package texlive-extra-utils
      E: Unable to locate package texlive-generic-recommended
      E: Unable to locate package texi2html
      E: Unable to locate package python-pygraphviz
      E: Unable to locate package python-kiwi
      E: Unable to locate package python-pygoocanvas
      E: Unable to locate package libgoocanvas-dev
      E: Unable to locate package python-pygccxml

      Delete
    3. After downloading nsallinone-3.13 i got this error after giving command
      tar xjf ns-allinone-3.19.tar.bz2

      error
      tar (child): ns-allinone-3.19.tar.bz2: Cannot open: No such file or directory
      tar (child): Error is not recoverable: exiting now
      tar: Child returned status 2
      tar: Error is not recoverable: exiting now

      Delete
    4. tar xjf ns-allinone-3.13.tar.bz2

      Delete
  5. This was cool. Though there are a few bugs that users may face during installation that are not discussed. If anyone faces so: check this link out

    http://www.nsnam.org/wiki/Installation

    http://askubuntu.com/questions/162879/how-to-fix-could-not-open-lock-file-because-permission-denied

    amd make sure u run sudo su before running the link on the terminal as vivita has rightly told in a section above.

    Cheers! and Kudos to you

    ReplyDelete
  6. belhadj@ubuntu:~/repos$ wget http://www.nsnam.org/release/ns-allinone-3.19.tar.bz2
    --2015-03-12 22:15:13-- http://www.nsnam.org/release/ns-allinone-3.19.tar.bz2
    Resolving www.nsnam.org (www.nsnam.org)...
    143.215.76.161
    Connecting to www.nsnam.org (www.nsnam.org)|143.215.76.161|:80... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: https://www.nsnam.org/release/ns-allinone-3.19.tar.bz2 [following]
    --2015-03-12 22:15:14-- https://www.nsnam.org/release/ns-allinone-3.19.tar.bz2
    Connecting to www.nsnam.org (www.nsnam.org)|143.215.76.161|:443... connected.
    ERROR: cannot verify www.nsnam.org's certificate, issued by `/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Domain Validation CA - SHA256 - G2':
    Unable to locally verify the issuer's authority.
    To connect to www.nsnam.org insecurely, use `--no-check-certificate'.

    ReplyDelete
  7. what is the solution to this bash: ./test.py: No such file or directory in ns3

    ReplyDelete
  8. how to check whether ns3 is installed or not in terminal

    ReplyDelete
  9. sudo: unable to change to sudoers gid: Operation not permitted

    ReplyDelete
  10. please,give command step by step so, new user can easily understand...

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete
  12. thanks a lot. this is great!!!!

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  13. what i do after i copy the text in the terminal

    ReplyDelete
  14. hi while running following command " ./build.py --enable-examples --enable-tests " i m getting build failed ... so what to do for that ??? could you please help me

    ReplyDelete
  15. How to run aodv routing protocol in ns3?

    ReplyDelete
  16. there are two dependencies not included, libqwt5-qt4-dev qt4-qmake, its for compile netanim, on ubuntu 14.04 and ns_3.25.

    ReplyDelete
  17. bash: ./waf: No such file or directory
    What shall I do?

    ReplyDelete
  18. .cc file are compiling even when I run ./test.py . Is this supposed to happen?

    ReplyDelete
  19. should i uninstall ns2 if i want to install ns3 please mail me at ashutoshholla28@gmail.com

    ReplyDelete
  20. ./waf -d debug

    when i run this command it shows there is no such directory

    ReplyDelete
  21. Hi....am getting the following error while building a routing file- manet_routing_compare.cc.Please help!!!!

    [ 862/1797] Compiling scratch/gauss-markov-mobility-model.cc
    ../scratch/gauss-markov-mobility-model.cc:25:41: fatal error: gauss-markov-mobility-model.h: No such file or directory
    #include "gauss-markov-mobility-model.h"
    ^
    compilation terminated.

    Waf: Leaving directory `/home/usha/repos/ns-3-allinone/ns-3-dev/build'
    Build failed
    -> task in 'gauss-markov-mobility-model' failed (exit status 1):
    {task 3065829516L: cxx gauss-markov-mobility-model.cc -> gauss-markov-mobility-model.cc.5.o}
    ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-std=c++11', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-pthread', '-I.', '-I..', '-DNS3_BUILD_PROFILE_DEBUG', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_IF_TUN_H=1', '../scratch/gauss-markov-mobility-model.cc', '-c', '-o', '/home/usha/repos/ns-3-allinone/ns-3-dev/build/scratch/gauss-markov-mobility-model.cc.5.o']

    ReplyDelete
  22. I get"Package 'libgsl0ldbl' has no installation candidate" error and can not fix it. Any help about it?

    ReplyDelete
  23. I got Message "Build finished successfully" but as i run next command "./waf -d debug --enable-examples --enable-tests configure" Error Comes Bash:CD ./walf no such file or directory exist

    ReplyDelete
  24. how to resolve this error.. please



    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Note, selecting 'libgsl-dev' instead of 'libgsl0-dev'
    Package libgsl0ldbl is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    However the following packages replace it:
    libgsl2 libgsl2:i386

    E: Package 'libgsl0ldbl' has no installation candidate

    ReplyDelete
  25. hi,
    i have problem like this, can help me?

    # Build NetAnim
    Entering directory `netanim-3.104'
    => qmake -v
    qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
    Could not find qmake in the default path
    => qmake-qt4 -v
    Could not find qmake-qt4 in the default path
    => qmake NetAnim.pro
    qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
    Error building NetAnim.
    Skipping NetAnim ....
    Leaving directory `netanim-3.104'
    # Building examples (by user request)
    # Building tests (by user request)
    # Build NS-3
    Entering directory `./ns-3.19'
    => /usr/bin/python waf configure --enable-examples --enable-tests --with-pybindgen ../pybindgen-0.16.0.834
    Setting top to : /home/ubuntu/ns3/ns-allinone-3.19/ns-3.19
    Setting out to : /home/ubuntu/ns3/ns-allinone-3.19/ns-3.19/build
    Checking for 'gcc' (c compiler) : /usr/bin/gcc
    Checking for cc version : 4.8.4
    Checking for 'g++' (c++ compiler) : not found
    Checking for 'icpc' (c++ compiler) : not found
    could not configure a c++ compiler!
    (complete log in /home/ubuntu/ns3/ns-allinone-3.19/ns-3.19/build/config.log)
    Traceback (most recent call last):
    File "./build.py", line 170, in
    sys.exit(main(sys.argv))
    File "./build.py", line 161, in main
    build_ns3(config, build_examples, build_tests, args, build_options)
    File "./build.py", line 80, in build_ns3
    run_command(cmd) # waf configure ...
    File "/home/ubuntu/ns3/ns-allinone-3.19/util.py", line 24, in run_command
    raise CommandError("Command %r exited with code %i" % (argv, retval))
    util.CommandError: Command ['/usr/bin/python', 'waf', 'configure', '--enable-examples', '--enable-tests', '--with-pybindgen', u'../pybindgen-0.16.0.834'] exited with code 1

    ReplyDelete