Pages

Search This Blog

Tuesday, 18 October 2011

Installing ns-2.34 on Ubuntu 11.04

NS2 is a popular discrete event simulator for simulating different types of networks. In this article i will show you how to install NS-2.34 on Ubuntu 11.04.  

Note: Please connect your pc to internet, it is very important because failure of connection may cause some error in installing ns2 or in some future work.

  • Download ns2.34 from here. 
  • Copy ns-allinone-withpath-2.34.tbz to /tmp directory.
  • Copy it to the /usr/local directory using terminal by using following command
       sudo cp /tmp/ns-allinone-withpath-2.34.tbz /usr/local/     
  • Change directory to /usr/local
       cd /usr/local/
  • Extract it using the following command
       sudo tar -jxvf ns-allinone-withpath-2.34.tbz 
  • Change directory to ns-allinone-2.34
       cd ns-allinone-2.34/
  • Now, install the development files for X Windows plus the g++ compiler:
       sudo apt-get install xorg-dev g++ xgraph
  • Fix the error in the linking of otcl by editing line 6304 of otcl-1.13/configure so that it reads                    
        SHLIB_LD="gcc -shared"
        instead of
        SHLIB_LD="ld -shared"

  • Then, edit the file 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 read
        resultPower = ErlangRandomVariable(Pr/m, int_m).value();
        and
        resultPower = GammaRandomVariable(m, Pr/m).value(); 

  • Install gcc-4.4 and g++-4.4 including dependencies using the code below:
        $ sudo apt-get install gcc-4.4 g++-4.4 
              If there is any occur while installing these than you can use 
        sudo synaptic
        here you can search it and easily download and install it. 
  • Now, change the line 270 in tcl8.4.18/unix/Makefile.in that reads
        CC = @CC@
        so it appends the version parameter for version 4.4:
        CC = @CC@ -V 4.4
         Make sure it is a capital V.

  • Finally,run the command
         sudo ./install
  • After installation type the following command in a terminal
          source /etc/profile.d/ns2.sh
Now ns-2.34 is installed on ubuntu 11.04, you can check it by typing "ns" on terminal and press enter.

2 comments:

  1. Can i get the solution to this problem given below
    when i run the file ns example1b.tcl ( taken from ns2 tutorials for beginners), i get this error

    ( also note, few lines omitted due to space limit )


    *** buffer overflow detected ***: nam terminated
    ======= Backtrace: =========
    /lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x50)[0x650df0]
    /lib/i386-linux-gnu/libc.so.6(+0xe4cca)[0x64fcca]
    /lib/i386-linux-gnu/libc.so.6(__strcpy_chk+0x3f)[0x64f05f]
    nam[0x814ccd0]
    nam[0x815189e]

    nam[0x81512c9]

    nam[0x808c02b]
    nam[0x8061f81]
    /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x581e37]
    nam[0x804eb11]
    ======= Memory map: ========
    00110000-00127000 r-xp 00000000 08:07 1055097 /usr/lib/i386-linux-gnu/libxcb.so.1.1.0
    00127000-00128000 r--p 00016000 08:07 1055097 /usr/lib/i386-linux-gnu/libxcb.so.1.1.0
    00128000-00129000 rw-p 00017000 08:07 1055097
    00249000-00265000 r-xp 00000000 08:07 5899060 /lib/i386-linux-gnu/ld-2.13.so
    00265000-00266000 r--p 0001b000 08:07 5899060 /lib/i386-linux-gnu/ld-2.13.so
    00266000-00267000 rw-p 0001c000 08:07 5899060 /lib/i386-linux-gnu/ld-2.13.so
    0
    00359000-00373000 r-xp 00000000 08:07 5899101 /lib/i386-linux-gnu/libgcc_s.so.1bffd5000-bfff6000 rw-p 00000000 00:00 0 [stack]
    root@manjula-OptiPlex-990:/home/manjula/ns-allinone-2.34/ns-2.34/tcl/ex#


    Hope i get the reply
    Regards
    manjula

    ReplyDelete
    Replies
    1. Did you follow the instructions closely? Especially the ones starting with ‘Install gcc-4.4 and g++-4.4 including…’ or while installing did you connect your pc to internet? it is very important.
      It might help.

      Delete