Monday, May 4, 2009

Setting up NS2 in Ubuntu

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

2. Place it in somewhere and extract it.
$ cd /home/installations
$ tar -xvf ns-allinone-2.33.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.33
$ ./install
5. Edit paths.
$ gedit ~/.bashrc
Add follwoing lines on that file.
# LD_LIBRARY_PATH
OTCL_LIB=/home/installations/ns-allinone-2.33/otcl-1.13
NS2_LIB=/home/installations/ns-allinone-2.33/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/installations/ns-allinone-2.33/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/home/installations/ns-allinone-2.33/bin:/home/installations/ns-allinone-2.33/tcl8.4.18/unix:/home/installations/ns-allinone-2.33/tk8.4.18/unix
NS=/home/installations/ns-allinone-2.33/ns-2.33/
NAM=/home/installations/ns-allinone-2.33/nam-1.13/
export PATH=$PATH:$XGRAPH:$NS:$NAM
6. Validate it.
$ cd ns-2.33
$ ./validate
7. Create a symlink.
$ sudo ln -s /home/installations/ns-allinone-2.33/ns-2.33/ns /usr/bin/ns
8. Run it.
$ ns

4 comments:

Unknown said...

5 stars man............

Heshan Suriyaarachchi said...

Thanks Arsh :)

When I get a free time, will write a blogpost on how to run a network simulation with NS2.

Unknown said...

i have installed NS-2.34..but the problem showing is,when i type the command
"ns .tcl"
it gives .tcl doesnot exist,try again..even though the respective file is there..

Unknown said...

hi To install NS2 in Ubuntu in two minutes refer this blog http://www.suneelshinde.blogspot.com/.... no need to change .bashrc,environment variables..etc just i have made some setup files .. click on them and click install directly within two minutes..ur Ns2 is installed..