Friday, November 11, 2011

Install NS2 on Fedora 16


Here is the step by step info of installing NS2 on Fedora 16.
NS2 Pops up errors during Install on Fedora 16 due to change in GCC version 4.6.2, has some changes like it accept X() rather than X::X(), which affected ns2.

Only 3 files needs to be changed (Or download the patch below)

~ns-allinone-2.34/ns-2.34/mobile/nakagami.cc
~ns-allinone-2.34/ns-2.34/tools/ranvar.cc &

Patch Info

~ns-allinone-2.34/ns-2.34/mobile/nakagami.cc ( Line 183 & 185 )
--resultPower = ErlangRandomVariable::ErlangRandomVariable(Pr/m, int_m).value();
++resultPower = ErlangRandomVariable(Pr/m, int_m).value();
--resultPower = GammaRandomVariable::GammaRandomVariable(m, Pr/m).value();
++resultPower = GammaRandomVariable(m, Pr/m).value();

~ns-allinone-2.34/ns-2.34/tools/ranvar.cc ( Line 118 )
--return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);
++return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);

~ns-allinone-2.34/ns-2.34/mac/mac-802_11Ext.h

++#include #open that file and add to the header files.

Now to install Follow the normal procedure!!

The ns2 version taken here is 2.34 (ns-allinone-2.34) .Please modify to suit your version

Pre-Installation:
Before NS2 installation somepackages must be installed. Required packages are:

yum install gcc tcl-devel libX11-devel libXt-devel autoconf automake libXmu-devel

Installation:

> Uncompress the ns2 use GUI or Terminal

tar zxvf ns-allinone-2.34.tar.gz
orion
gzip -d ns-allinone-2.34.tar.gz
tar xvf ns-allinone-2.34.tar

> cd /home/username/Desktop/ns-allinone-2.34

> ./install (execute the script)

> If the installation fails in the middle, then try to install the linux packages that are missing

> Once the installation succeeded, then a set of path information will be provided by the NS2

> Set the path in the /root/.bash_profile
(vi /root/.bash_profile)

or

If you are a user home//.bash_profile

vi /home/username/.bash_profile

# User specific aliases and functions
# LD_LIBRARY_PATH
OTCL_LIB=/home/username/Desktop/Study/ns-allinone-2.34/otcl-1.13
NS2_LIB=/home/username/Desktop/Study/ns-allinone-2.34/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB

# TCL_LIBRARY
TCL_LIB=/home/username/Desktop/Study/ns-allinone-2.34/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/home/username/Desktop/Study/ns-allinone-2.34/bin:/home/username/Desktop/Study/ns-allinone-2.34/tcl8.4.18/unix:/home/username/Desktop/Study/ns-allinone-2.34/tk8.4.14/unix
NS=/home/username/Desktop/Study/ns-allinone-2.34/ns-2.34/
NAM=/home/username/Desktop/Study/ns-allinone-2.34/nam-1.14/
PATH=$PATH:$XGRAPH:$NS:$NAM

> go to the terminal and try ns or nam

> for running the examples comes along with the distribution of NS2
cd ns-allinone-2.31/ns-2.31/tcl/ex

After these steps, you can now run the ns validation suite with
cd ns-2.31; ./validate

No comments:

Post a Comment

Counter

blogger analytics