Thursday, 26 December 2013

ns2 installation process in ubantu 12.04

1.Download ns-allinone-2.34.tar.gz file  from
      http://sourceforge.net/projects/nsnam/files/

2.Copy the ns-allinone-2.34.tar.gz file in to the desktop directory.
    Note: All the commands listed from here assumes the ns2 to be in desktop;     you can put the extracted file anywhere and change the address in the commands correspondingly.

3.open terminal type:
         sudo apt-get update  (to get list of update packages/libraries in OS)

3.Install required libraries for ns2 using terminal:
           sudo apt-get install build-essential autoconf automake libxmu-dev
           sudo apt-get install xorg-dev g++ xgraph

4.Extract the ns-allinone-2.34.tar.gz file by typing following commands in terminal:
         cd Desktop <Enter>
        tar zxvf  ns-allinone-2.34.tar.gz <Enter>
  (A new folder named ns-allinone-2.34 will be generated.)

5.To avoid installation errors modify the specified files in ns-allinone-2.34 folder as specified below:
   
        i.In ns-allinone-2.34/otcl-1.13/configure
            change into
            SHLIB_LD="gcc -shared"
                       instead of
            SHLIB_LD="ld -shared"

      ii.ns-allinone-2.34/ns-2.34/tools/ranvar.cc  line:219 change
       return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);
                      to
            return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);

    iii.Change the lines 183 % and 185 in file ns-allinone-2.34/ns-2.34/mobile/nakagami.cc to
              resultPower = ErlangRandomVariable(Pr/m, int_m).value();
                      and
              resultPower = GammaRandomVariable(m, Pr/m).value();
                                    respectively.

    iv.Next add a bellow line after line 64 in ns-allinone-2.34/ns-2.34/mac/mac-802_11Ext.h
              #include <stddef.h>

6. Installation. in terminal goto Desktop/ns-allinone-2.34 and type:
                ./install
    This takes about 5min and note down the instructions you get for setting path.
 
7. Setting Path;According to instructions you get on the terminal after installation change the following path

    i.In terminal sudo gedit ~/.bash_aliases

    ii.Then copy the following path into .bash_aliases and modify according to your instructions:
        
    # LD_LIBRARY_PATH
    OTCL_LIB=/home/anurag/Desktop/ns-allinone-2.34/otcl-1.13
    NS2_LIB=/home/anurag/Desktop/ns-allinone-2.34/lib
    X11_LIB=/usr/X11R6/lib
    USR_LOCAL_LIB=/usr/local/lib
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB

    # TCL_LIBRARY

    TCL_LIB=/home/anurag/Desktop/ns-allinone-2.34/tcl8.4.18/library
    USR_LIB=/usr/lib
    export TCL_LIBRARY=$TCL_LIB:$USR_LIB

    # PATH

    XGRAPH=/home/anurag/Desktop/ns-allinone-2.34/bin:/home/anurag/Desktop/ns-allinone-2.34/tcl8.4.18/unix:/home/anurag/Desktop/ns-allinone-2.34/tk8.4.18/unix
    NS=/home/anurag/Desktop/ns-allinone-2.34/ns-2.34/
    NAM=/home/anurag/Desktop/ns-allinone-2.34/nam-1.14/
    PATH=$PATH:$XGRAPH:$NS:$NAM

       iii.Then it takes effect immediately you should give below mentioned using terminal.
        source ~/.bashrc
     
8. Now move to Desktop/ns-allinone-2.34/ns-2.34 and type:
        ./validate
   Validations tests are performed for about 10-15 min.

9.If you type ns in your terminal should be displayed.

-----------------------------------------This Completes the installation----------------------------------------


No comments:

Post a Comment