Installing NS-2.35 in Ubuntu 11.04

INSTALLING ns-2.35 IN UBUNTU 11.04

 Step 1:

Download ns-allinone-2.34 package from NS2 official site. At present the latest version was 2.35    (http://www.isi.edu/nsnam/dist/ns-src-2.xx.tar.gz)

Step 2:

Copy the ns-allinone-2.34.tar.gz file in your home folder(/home/raj/Desktop in my case).

I have copied it on my desktop.

Extract the contents of the folder using command.

tar -xzvf ns-allinone-2.34.tar.gz                (it will create a file name ns-allinone-2.34)

Step 3:

Open terminal (ctrl+alt+t) and change directory to the ns folder.

$ cd /home/raj/Desktop/ns-allinone-2.34

Step 4:

Install the dependencies

$ sudo apt-get install build-essential autoconf automake libxmu-dev

$ sudo apt-get install gcc-4.4 g++-4.4

Edit Makefile.in which is found at this location ns-allinone-2.34/otcl-1.14/Makefile.in

as follows:

the line number 270 that says:
“CC= @CC@” and make it “CC=@CC@ -V 4.4″                       note : it is caps V not v.

Step 5:

Edit the file ns-2.34/tools/ranvar.cc and change the line 219 :

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_);

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

open the file ns-2.34/otcl-1.13/configure and change the line number 6304 toSHLIB_LD=”gcc -shared” instead of SHLIB_LD=”ld -shared”

Step 6:

Begin ns2.34 installation

$ ./install

The installation runs for a couple of minutes. Don’t get freaked out on seeing the varieties of warnings and messages over there. . Its normal. Don’t close this terminal. We got some important information in the last section of the installation.

Step 6 :
Add the path information to the file ~/.bashrc

$ gedit ~/.bashrc

Append the following lines to the file ~/.bashrc

export PATH=$PATH:/home/raj/Desktop/ns-allinone-2.34-RC7/bin:/home/raj/Desktop/ns-allinone-2.34-RC7/tcl8.5.8/unix:/home/raj/Desktop/ns-allinone-2.34-RC7/tk8.5.8/unix

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/raj/Desktop/ns-allinone-2.34-RC7/otcl-1.14:/home/raj/Desktop/ns-allinone-2.34-RC7/lib

export TCL_LIBRARY=$TCL_LIBRARY:/home/raj/Desktop/ns-allinone-2.34-RC7/tcl8.5.8/library

Here replace /home/raj/Desktop with the path to your home folder.

Step 7 : For immediate effect, enter the following command in the terminal.

$ source ~/.bashrc

Thats it, folks!! Now type ns in terminal. A ‘%’ symbol will be displayed denoting that interpreter is working. Installation Success!!

Advertisements

One comment on “Installing NS-2.35 in Ubuntu 11.04

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s