Pages

Monday, February 13, 2012

Installing ns-2.35 on Ubuntu 10.04

A lot of people dread having to install ns2. Well here is a simple tutorial to get you through in just a single go. Mostly people fail at installing ns2 in the first go because of the missing libraries and dependencies.

Here is what you do to install ns2 in the first go.

1. Download ns-allinone-2.35

2. cd into the directory where you have downloaded the ns-allinone-2.35.tar.gz file.
tar -xvzf ns-allinone-2.35.tar.gz

3. Next you need to install the required libraries

sudo apt-get install autoconf automake gcc g++ build-essential libxmu-dev libtool libxt-dev 

6. Now cd into the ns-allinone-2.35 directory and do ./install , hopefully everything will go smoothly and you ns-2 will be installed. But before you can proceed you need to set the environment variables.

gedit ~/.bashrc
copy the following lines at the end of the file, be sure to change /your/path to the path where ns is installed on your system.

# LD_LIBRARY_PATH
OTCL_LIB=/your/path/ns-allinone-2.35/otcl-1.14
NS2_LIB=/your/path/ns-allinone-2.35/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=/your/path/ns-allinone-2.35/tcl8.5.10/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/your/path/ns-allinone-2.35/bin:/your/path/ns-allinone-2.35/tcl8.5.10/unix:/your/path/ns-allinone-2.35/tk8.5.10/unix
NS=/your/path/ns-allinone-2.35/ns-2.35/
NAM=/your/path/ns-allinone-2.35/nam-1.15/
PATH=$PATH:$XGRAPH:$NS:$NAM

for instance on my system i would replace /your/path with /home/z3d

9. source ~/.bashrc to have the changes take effect or you can simply reopen terminal.

10. Now cd into the folder /ns-allinone-2.35/ns-2.35/ and type the command ./validate
it will take a considerably longer time than it did to install and in almost an hour you should get a message all tests successful.

11. Now you can type ns and begin doing your work :)

5 comments:

  1. it worked !!!...thank you so much

    ReplyDelete
  2. this error comes every time when i type ~$ source ~/.bashrc
    hina@ubuntu:~$ source ~/.bashrc
    bash: 2.35/tcl8.5.10/unix:/home/hina/Downloads/ns-allinone-2.35/tk8.5.10/unix: No such file or directory
    hina@ubuntu:~$

    ReplyDelete
  3. The path is not correct in the bashrc file. Check to see if the paths are correct. Possibly there may be a change of the tcl and tk versions. You need to change the paths accordingly. Ls into the ns directory to see what versions are present

    ReplyDelete
  4. /home/hina/Downloads/ns-allinone-2.35/tk8.5.10/unix
    This path is same with same version of tcl and tk

    ReplyDelete