(1) Download ns2.34
http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.34/ns-allinone-2.34.tar.gz/downloador from any where else.
(2) Unzip the ns-allinone-2.34.tar.gz to any place where you want to install your ns. In my case I want to unzip it in /home/gz/ (note that my zipped folder of ns2 was in /home/gz)
$ cd /home/gz
$ tar -xzvf ns-allinone-2.34.tar.gz
(3) $cd ns-allinone-2.34
(4) $sudo apt-get install build-essential autoconf automake libxmu-dev
(5) $./install
Errors:
It will take some time. After this step you may encounter some errors like the following snapshot
gcc-4.3: command not found make: *** [libotcl.so] Error 1 otcl-1.13 make failed! Exiting ...
If you get the errors as above, follow the steps from 5.1 to 5.6, otherwise go to step (6)
5.1 $gedit otcl-1.13/Makefile.in
5.2 Edit the file: replace CC= @CC@ by CC= gcc-4.3
5.3 $sudo apt-get install g++-4.3
5.4 $cd ns-allinone-2.34
5.5 $CC=gcc-4.3 CXX=g++-4.3 ./install
5.6 You are done if you get the following screen
(6) $ gedit ~/.bashrc
It will open the file shown below. Edit the lines that are highlighted according to your path of ns2. I installed my ns2 in /home/gz/ns-allinone-2.34
# LD_LIBRARY_PATHOTCL_LIB=/home/gz/ns-allinone-2.34/otcl-1.13NS2_LIB=/home/gz/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/gz/ns-allinone-2.34/tcl8.4.18/library USR_LIB=/usr/lib export TCL_LIBRARY=$TCL_LIB:$USR_LIB # PATH XGRAPH=/home/gz/ns-allinone-2.34/binhome/gz/Downloads/ns-allinone-2.34/ tcl8.4.18/unix:/home/gz/ns-allinone-2.34/tk8.4.18/unix NS=/home/gz/ns-allinone-2.34/ns-2.34/ NAM=/home/gz/ns-allinone-2.34/nam-1.14/ PATH=$PATH:$XGRAPH:$NS:$NAM |
(7) $ source ~/.bashrc
(8) $cd ns2.34
(9) $./validate
It will take long time to finish(longer than the install)
If you get this screen shot, you are successful.
(10) Create a symlink, so that ns can be called from everywhere
$ sudo ln -s /home/gz/ns-allinone-2.34/ns-2.34/ns /usr/bin/ns
(11) $reboot
to restart the system.
(12) To check whether ns is installed successfully or not, test it by entering $ns
If you are prompted with %, it means your installation is successful otherwise check your environment variables, specifically compare the versions of otcl, nam etc in ./bashrc with those in your ns-allinone-2.34.
Press exit to go back from %.
Pretty much Geeky stuff
Yeah that’s true. I spent a lot of time on it, and now hopefully this post will serve someone else across the open source community.
a very helpful guide
Thanks a lot, this was very helpful!!
My pleasure. Thanks
there is a mistake in symlink……….the symlink is created for ns-2.33 not for ns-2.34….
Thank you for notifying the mistake. I corrected it.
for ns2, please see these websites
http://www.pradeepkumar.org
http://www.nsnam.com
There is absolutely no need to reboot the system in step 11. Also “$reboot” would be a wrong command.
Symlink-ing in step 10 is also unnecessary. You should rather put “/home//ns-allinone-2.34/ns-2.34/” in your PATH variable.
after ./install i am getting
ctp/sctp.cc: At global scope:
sctp/sctp.cc:3239: error: expected initializer at end of input
make: *** [sctp/sctp.o] Error 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems
using ubuntu 10.10 LTS and ns2.34
thank you sir for this i have copied some commands and pictures, and make my own for newer versions, your this post is helpful for ubunto not for cygwin
when i type the bashrc command m not getting the file ur showing