Nov 9, 2009

How to install ns-2.34 on Ubuntu 9.10 Karmic Koala



If you are planning to install the latest ns-2.34 on Ubuntu 9.10 Karmic Koala, here are some basic steps

1. Download ns-allinone-2.34.tar from here.

2. Place it in somewhere, e.g. /home/simulator, then extract it.
$ cd /home/simulator
$ tar -xvf ns-allinone-2.34.tar


3. Download & install some packages from repository
$ sudo apt-get install build-essential autoconf automake libxmu-dev

4. Install the ns2
$ cd ns-allinone-2.34
$ ./install


5. You might face problem with the installation of otcl-1.13, the problem can be due to the gcc-4.4.1 / g++-4.4.1 compilers. But please try this :

sudo apt-get install g++-4.3
CC=gcc-4.3 CXX=g++-4.3 ./install


try to edit the Makefile.in too

From :
CC= @CC@

to :
CC= gcc-4.3


6. Edit some paths ==a
$ gedit ~/.bashrc

Put these lines on that file. Off course, you might change /home/simulator for it depends on where you extract ns-allinone-2.34.tar.
# LD_LIBRARY_PATH
OTCL_LIB=/home/simulator/ns-allinone-2.34/otcl-1.13
NS2_LIB=/home/simulator/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/simulator/ns-allinone-2.34/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/home/simulator/ns-allinone-2.34/bin:/home/simulator/ns-allinone-2.34/tcl8.4.18/unix:/home/simulator/ns-allinone-2.34/tk8.4.18/unix
NS=/home/simulator/ns-allinone-2.34/ns-2.34/
NAM=/home/simulator/ns-allinone-2.34/nam-1.13/
export PATH=$PATH:$XGRAPH:$NS:$NAM


7. Validate it
$ cd ns-2.34
$ ./validate


7. (Optionally) You can create a symlink, so that ns can be called from everywhere
$ sudo ln -s /home/simulator/ns-allinone-2.34/ns-2.34/ns /usr/bin/ns

8. Try to run it.
$ ns

[via]

19 comments:

  1. Thank you for your post! Really nice to see this.

    ReplyDelete
  2. Jorge Llantoy7:42 AM

    Thank, it really helped

    ReplyDelete
  3. Obrigado pela ajuda

    ReplyDelete
  4. myusgun3:50 PM

    Thank you so much

    ReplyDelete
  5. hello sir, i have one question about running the code in ns-2. i try to run the code for ieee 802.15.4 in ns 2.27 but there is an error where invalid command for 802_15_4. i have no idea on how to solve it.hope you can help me on solve it. thanks..

    ReplyDelete
  6. hi,
    i have done all the steps you mentioned till editing the bashrc file...
    then on runnning validate the result is lways "ns: not found" for all the testings

    then i browsed through the directories strangely there is no ns directory in the path /home/simulator/ns-allinone-2.34/ns-2.34 i downloaded the same file available on your blog

    ReplyDelete
  7. thank you.
    ur blog really helped me out to install ns-allinone-2.34 on ubuntu 9.10.

    really appreciate ur work.

    the only problem i found is nam-1.13, which is nam-1.14 in ns-allinone-2.34.
    only this much change is there.

    everything else works fine......

    ReplyDelete
  8. Anonymous5:46 PM

    hi... all..

    i am installing ns-2 since two months, but i always found 'ns: command not found', i don't know how its happens always.
    i read lot of blogs do this, do that, i tried all, but no result.
    i also found new things there is no ns/usr/bin folder in ns-2.34.
    so please help me, how to come out from this problem.

    ReplyDelete
  9. mosisa

    oh! appreciate ur work it done..
    thanks
    but on step 8 i cant run by giving $ns
    i hope u can solve it

    ReplyDelete
  10. thank you for your useful post.

    ReplyDelete
  11. tnchethan9:38 AM

    Hello sir,

    I followed your steps while installing NS2 in ubuntu 9.10, but got some error while creating make file. The error is:
    Creating make file
    Make; warning: file "/home/ubuntu/simulator/ns-allinone-2.34/tcl8.4.18/unix/Make/bin/sh' has modification time 3.3e+08 s in the future.

    please give solutions to this error.

    ReplyDelete
  12. chethan9:41 AM

    hello sir I have installed ns-2.34 in ubuntu but not succesful while installing it. For next installation whether I need to uninstall the previously installed or just Deleting ns directory can uninstall our previous installation. So, please guide us to uninstall.

    ReplyDelete
  13. is there a good analysis program for the .tr output files or do I have to write my own?

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

    ReplyDelete
  15. Anonymous2:57 AM

    Thank you it was very helpful!!

    ReplyDelete
  16. Hey, your post was really helpful in installing ns2.
    Now, I want to uninstall it. Can you tell me how to go about it??

    Thanks

    ReplyDelete
  17. Anonymous1:10 AM

    WHEN INSTALL NS2
    fatal error X11/X.H NO SUCH FILE OR DIRECTORY

    PLEASE HELP

    ReplyDelete
  18. Hello, that's very very nice of you, that was some real helpful job, thank you so much !!!!!! :))))))))))

    ReplyDelete
  19. Thank you very much for your help....I just had a generic query....Where to put all these commands ? i.e. Should I use TCL interface or Unix environment to write and execute them ?

    Thanks,

    ReplyDelete