NS2 on Fedora


Written by

My friend needed NS2 installed on Fedora 14 and he wasn’t confident in BASH (Borne Again SHell) so I helped him a little. I don’t have a Fedora install at the moment but this his how we finally got it installed. It isn’t an easy install procedure.

yum install gcc-c++ libX11-dlevel xorg-x11-proto-devel libXt-devel libXmu-devel wget
wget http://downloads.sourceforge.net/project/nsnam/allinone/ns-allinone-2.34/ns-allinone-2.34.tar.gz?r=http%3A%2F
tar -xzvf ns-allinone-2.34.tar.gz
cd ns-allinone-2.34.tar.gz
gedit ns-allinone-2.34/ns-2.34/mobile/nakagami.cc

This will open up the gedit editor, if you have KDE, change this for kate.

Change the following:

183
resultPower = ErlangRandomVariable::ErlangRandomVariable(Pr/m, int_m).value();

to

183
resultPower = ErlangRandomVariable(Pr/m, int_m).value();

and change:

185
resultPower = GammaRandomVariable::GammaRandomVariable(m, Pr/m).value();

to

185
resultPower = GammaRandomVariable(m, Pr/m).value();

save and exit

then type

gedit ns-2.34/tools/ranvar.cc

and edit:

219
return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);

to

219
return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);

save and exit.

Now:

./install
gedit ~/.bashrc

and add this to the file:

# LD_LIBRARY_PATH
OTCL_LIB=~/ns-allinone-2.34/otcl-1.13
NS2_LIB=~/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_LI B:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY
TCL_LIB=~/ns-allinone-2.34/tcl8.4.14/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=~/ns-allinone-2.34/bin:~/ns-allinone-2.34/tcl8.4.14/unix:~/ns-allinone-2.34/tk8.4.14/unix
NS=~/ns-allinone-2.34/ns-2.34/
NAM=~/ns-allinone-2.34/nam-1.13/
PATH=$PATH:$XGRAPH:$NS:$NAM

save and exit

source ~/.bashrc

This should hopefully work. If someone has an updated/corrected guide then please contact me and I’ll fix it.
If you are having problems with xgraph, try gnuplot, its slightly different but still plots graphs.

yum install gnuplot

This guide may work on Red Hat Linux too as Fedora and Red Hat are developed from the same arm of Linux distros.