How to install NS2 2.34 on ubuntu 10.04

Download ns-allinone-2.34 and Install
Cut the downloaded file from the Downloads folder and paste it to your desired folder for installation
$ tar -xzvf ns-allinone-2.32.tar.gz
$ cd ns-allinone-2.32
(before install ns-2 you will need the packages that are shown below )
$ sudo apt-get install build-essential autoconf automake libxmu-dev
$ sudo apt-get install libx11-dev libxmu-dev libxmu-headers libxt-dev libtool
$ sudo apt-get install dpkg-dev g++ libc6-dev make
$ sudo apt-get install tcl8.4 tk8.4
$ sudo apt-get install build-essential
These packages might be dependent on each other so I remember installing the packages in reverse order.

Install the development files for X Windows plus the g++ compiler:
sudo apt-get install xorg-dev g++ xgraph
Fix the error in the linking of otcl by editing line 6304 of otcl-1.13/configure so that it reads
SHLIB_LD="gcc -shared"

instead of
SHLIB_LD="ld -shared"

$ sudo apt-get install build-essential autoconf automake libxmu-dev gcc-4.3 
instead of the previous command would require to change the Makefile.in
Since my version was compatible I did not change it.

Change ns-allinone-2.34/otcl-1.13/Makefile.in. Find the line that says:
CC=    @CC@
and change it to
CC=    gcc-4.3
  

Now run this command
Come back to ns-allinone-2.34 folder.
$./install

after install ns-2 you should introduce ns-2 to your computer and edit the bash file
$ gedit ~/.bashrc
I added these lines at the end. Change the path accordingly.

#LD_LIBRARY_PATH
OTCL_LIB=/home/pushpita/ns-allinone-2.34/otcl-1.13
NS2_LIB=/home/pushpita/ns-allinone-2.34/lib
USR_LOCAL_LIB=/usr/local/lib
export
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$otc
#TCL_LIBRARY
TCL_LIB=/home/pushpita/ns-allinone-2.34/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/home/pushpita/ns-allinone-2.34/bin:/home/pushpita/ns-allinone-2.34/tcl8.4.18/unix:/home/pushpita/ns-allinone-2.34/tk8.4.18/unix
NS=/home/pushpita/ns-allinone-2.34/ns-2.34/
NAM=/home/pushpita/ns-allinone-2.34/nam-1.14/
PATH=$PATH:$XGRAPH:$NS:$NAM
$ source ~/.bashrc
you should write command at the above, otherwise you cant write ns2 succesfully
Now, open new console and write ns, you will see % at the console.
be carefull!!! you can see % after write ns at any path...by the way to exit from % you
should write “exit” on your console.
 
Validation
After these steps, you can now run the ns
validation suite with
$ cd ns-2.34 $ ./validate
after this process you can run some files from ns-allinone/ns-2.32/tcl/ex/.....tcl and see the results.
NAM
when you run the tcl file if it generates a nam file you can trace it. HOW? go to path where is the tcl source code. than run your tcl code. and write “nam” on your console than small window will appear and click open file than choose your nam file and open it. after that you will see the simulation of your tcl code.

Comments

Unknown said…
This comment has been removed by the author.
Unknown said…
Hello, your article was good. But it'd be better if you increase the font size. The articles were good.... Why don't you have a look at my blog?
The link to my blog is selcouthaegis.blogspot.in
Hey Pashupita,
the article is very good, helped me a lot! thanks!
Also, do you have any experience in working in NS2 and could find some time to help me learn? Even some good links will be very helpful.
Cheers,
Saumya

P.S:Glad to see a woman's blog post for a change while searching for technical help.
Unknown said…
I am using ubuntu 10.04 where I need to replace gcc-4.3 to gcc-4.4 since this is latest version available here
that worked fine.

Thank you!
from Sandesh Bolegaonkar
MS Bidve Engineering Latur

Popular posts from this blog

How to install leach protocol on ns2.34 in ubuntu 9.10