LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Blogs > kuldip acharya 2012
User Name
Password

Notices

Rate this Entry

ns2.34 in ubuntu11.04

Posted 02-09-2012 at 01:27 AM by kuldip acharya 2012
Updated 02-13-2012 at 08:45 AM by kuldip acharya 2012

To install ns2.34 in ubuntu 11.04
This method , pls, read carefully...!

Step 1 : Download the ns-allinone-2.34 from this site:
http://bit.ly/downloadns

Step 2 : Place the ns-allinone-2.34.tar.gz package in your home folder(/home/micman in my case). Right click the package and extract the contents in the same folder.

Step 3: Next, open the Terminal (Applications --> Accessories --> Terminal) or [ctrl+ alt + t]

Step 4: Change to ns-allinone2.34 directory
$ cd /home/kuldip/ns-allinone-2.34

Step 5: First install all the dependencies

$ sudo apt-get install build-essential autoconf automake libxmu-dev gcc-4.4 g++-4.4

$ sudo apt-get install xorg-dev xgraph

Edit Makefile.in found at this location ns-allinone-2.34/otcl-1.13/Makefile.in as follows:

Find the line that says:
CC= @CC@
and change it to:
CC= gcc-4.4



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"

Change the line 270 in tcl8.4.18/unix/Makefile.in that reads
CC = @CC@
so it appends the version parameter for version 4.4:
CC = @CC@ -V 4.4
Make sure it is a capital V.

$ sudo gedit ns-2.34/tools/ranvar.cc

change the line 219 from
return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);
to
return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);

$ sudo gedit ns-2.34/mobile/nakagami.cc

change the lines 183 and 185 in file ns-2.34/mobile/nakagami.cc to read
resultPower = ErlangRandomVariable(Pr/m, int_m).value();
and
resultPower = GammaRandomVariable(m, Pr/m).value();

Now the code will compile if you run ./install.


Change the line 270 in tcl8.4.18/unix/Makefile.in that reads
CC = @CC@
so it appends the version parameter for version 4.4:
CC = @CC@ -V 4.4
Make sure it is a capital V.

Finally, run ./install from the ns-allinone-2.34 top folder again.

Step 6 : Begin ns2.34 installation
$ sudo su
# ./install

step7: Once the installation is successful i.e without any errors, we need to add the path information to the file /home/micman/.bashrc


$ sudo gedit /home/kuldip/.bashrc
Append the following lines to the file /home/kuldip/.bashrc (after replacing the instances where you find kuldip with your username)

# LD_LIBRARY_PATH
OTCL_LIB=/home/kuldip/ns-allinone-2.34/otcl-1.13
NS2_LIB=/home/kuldip/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/kuldip/ns-allinone-2.34/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/home/kuldip/ns-allinone-2.34/bin:/home/kuldip/ns-allinone-2.34/tcl8.4.18/unix:/home/kuldip/ns-allinone-2.34/tk8.4.18/unix

#the above two lines beginning from xgraph and ending with unix should come on the same line

NS=/home/kuldip/ns-allinone-2.34/ns-2.34/
NAM=/home/kuldip/ns-allinone-2.34/nam-1.14/
PATH=$PATH:$XGRAPH:$NS:$NAM

For the changes to take effect immediately, do the following:

$ sudo su
# source /home/kuldip/.bashrc

$ ns
$ %
means mission complete
for tcl file testing
$ ns example.tcl
$ nam



OTHER PACKAGES IF Missing U CAN USE :
IF Network Animator is not opening, then
$ sudo apt-get install nam
Posted in Uncategorized
Views 262 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 03:25 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration