Installation of ns2 in Ubuntu

Installation of NS2 (ns-allinone-2.35) on Ubuntu 12.04
Following steps are the guide to install ns2 in windows after the ubuntu (linux) installation.
  • Install the follwing software before installing NS2

sudo apt-get install tcl8.5-dev tk8.5-dev

sudo apt-get install build-essential autoconf automake

sudo apt-get install perl xgraph libxt-dev libx11-dev libxmu-dev

  • Download ns2 from the following link

  • Extract ns-allinone-2.35.tar.gz into the home dirctory (/home/admin admin is username given in system) using the follwing command.

tar -zxvf ns-allinone-2.35.tar.gz -C /home/admin

  • Install NS2 using the follwing command

cd /home/anupamj/ns-allinone-2.35
sudo ./install>

  • Set PATH environment as follows

1. You MUST put /home/admin /ns-allinone-2.35/otcl-1.14, /home/admin/ns-allinone-2.35/lib, into your LD_LIBRARY_PATH environment variable.

If it complains about X libraries, add path to your X libraries into LD_LIBRARY_PATH.
If you are using csh, you can set it like: setenv LD_LIBRARY_PATH If you are using sh, you can set it like: export LD_LIBRARY_PATH=

2. You MUST put /home/admin/ns-allinone-2.35/tcl8.5.10/library into your TCL_LIBRARY environmental variable. Otherwise ns/nam will complain during startup.

  • Modify .bahrc

vi /home/admin/.bashrc
Go to the last line and add the scripts below:
export PATH=$PATH:/home/stan/ns-allinone-2.35/bin:/home/admin/ns-allinone-2.35/tcl8.5.10/unix:/home/admin/ns-allinone-2.35/tk8.5.10/unix
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/admin/ns-allinone-2.35/otcl-1.14:/home/admin/ns-allinone-2.35/lib
export TCL_LIBRARY=$TCL_LIBRARY:/home/admin/ns-allinone-2.35/tcl8.5.10/library
Enable the path setting:

  • Successful Installation of ns2 can be verified using the following command

cd ns-2.35; ./validate