Monday 27 August 2012

Installation of NS-2.34 on Ubuntu 11.04 and 12.04

Ø  if you are installing ns-allinone-2.34 in the root login of the desktop you should do the  following steps

Step: 1
Ø   Download ns-allinone-2.34.tar.gz file  from
Ø   Copy the ns-allinone-2.34.tar.gz file in to the desktop directory.
Step: 2
Ø   Then give cd Desktop in the Terminal Window
Ø   Extract the files in the same folder using extract option or the command in the terminal as
      root/ Desktop >tar zxvf  ns-allinone-2.34.tar.gz
Ø   The files will be extracted in the newly created folder as ns-allinone-2.34.
Ø   Then Install the development files for X Windows plus the g++ compiler:
     
root/ Desktop >apt-get install xorg-dev g++ xgraph
Step: 3
Ø  To avoid installation error before installation you should do the following changes in the following file and save it
Ø   In otcl-1.13/configure  
      change into
      SHLIB_LD="gcc -shared"
      instead of
      SHLIB_LD="ld -shared"
Ø   Then, edit the file in the ns-2.34/tools/ranvar.cc and change the line 219 from
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_);
Ø   Next, change the lines 183 and 185 in file ns-2.34/mobile/nakagami.cc to
      resultPower = ErlangRandomVariable(Pr/m, int_m).value();
                     
and
      resultPower = GammaRandomVariable(m, Pr/m).value();
Ø   Next add a bellow line after line 64 in ns-2.34/mac/mac-802_11Ext.h
      #include <stddef.h>
Ø   To Install gcc-4.4 and g++-4.4 including dependencies using the below :
      root/ Desktop > apt-get install gcc-4.4 g++-4.4
Ø   Then change the line 270 in tcl8.4.18/unix/Makefile.in
      change into
      CC = gcc-4.4
      instead of
      CC = @CC@
Ø   so it uses gcc version 4.4
Step: 4
Ø   for installation  of NS do the below mentioned in the terminal window
                root/ Desktop/ ns-allinone-2.34>./install
Ø   This command will run for 10-15 minutes. If it is a successful installation you will be getting IMPORTANT NOTICE notes (detailing about the paths to set)
Step: 5
Ø  After installation of NS you should edit the bash file to set path for that in the desktop directory give
    gedit ~/.bashrc

Ø   The in the opened file add this followings in the end of the file and Save it

     # LD_LIBRARY_PATH
    OTCL_LIB=/root/Desktop/ns-allinone-2.34/otcl-1.13
    NS2_LIB=/root/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=/root/Desktop/ns-allinone-2.34/tcl8.4.18/library
    USR_LIB=/usr/lib
    export TCL_LIBRARY=$TCL_LIB:$USR_LIB

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

Ø   Then it takes effect immediately you should give below mentioned in desktop directory using terminal.
source ~/.bashrc
Step: 6
Ø  Now close all the terminal and open a new terminal and get into the folder root/ns-allinone-2.34 and give ns command and you will be getting each time as below after pressing ENTER key. This indicates that the installation is complete.
   Root/ns-allinone-2.34>ns
  %
                            %exit
Step: 7
Ø  Now you can run the programs in a new terminal.




5 comments:

  1. hi sir,

    i have installed ns2.34 it is successfully installed and running examples.
    but when i installed ns-2.34-leach on it
    after configuring when i write
    ns or ./test
    it gives
    segmentation fault
    y is it so.. plz help me asap.

    ReplyDelete
  2. Hi Sir,

    I couldn't install ns2.34 on Ubuntu 12.04. I got this error.

    ranlib: could not create temporary file whilst writing archive: No more archived files
    make: *** [install-binaries] Error 1
    tcl8.4.18 installation failed.

    Could you help me
    Thank you

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

    ReplyDelete
  4. after doing all steps I got below mentioned errors ..........please help to remove the same.............


    galaxy@galaxy-HP-Compaq-4000-Pro-SFF-PC:~$ ns
    The program 'ns' is currently not installed. You can install it by typing:
    sudo apt-get install ns2
    galaxy@galaxy-HP-Compaq-4000-Pro-SFF-PC:~$ source ~/.bashrc
    bash: export: `:/home/galaxy/ns-allinone-2.34/otcl-1.13:/home/galaxy/ns-allinone-2.34/lib:/usr/X11R6/lib:/usr/local/lib': not a valid identifier
    galaxy@galaxy-HP-Compaq-4000-Pro-SFF-PC:~$

    ReplyDelete
  5. The file ns-allinone-2.34 is empty.I can't install ns2 in ubuntu 13.04.Pleaaaase help mee.

    ReplyDelete