AMAZON

Wednesday, September 19, 2012

Ns2 installation for different linux OS: fedora 17, ubuntu 12.04, Redhat


Installing Network Simulator 2 version

NS2.35 in Ubuntu 11.10,

Download NS-2.35 (http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz/download)

Unzip or untar it to any folder (recommended is /home/loginname) using the following commands one by one

sudo apt-get update
sudo apt-get build-essential autoconf automake libxmu-dev
tar zxvf ns-allinone-2.35.tar.gz
cd ns-allinone-2.35
./install

Once installed the PATH information will be provided to you. 
Copy the PATH and LD_LIBRARY_PATH Variable to .bashrc (see a dot in the beginning)
Input the path information in .bashrc file like this  
export PATH=$PATH:<Place your paths here>
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: <place the LD_LIBRARY_PATHS> here.
Once done, save the file and close

execute the command
source .bashrc

try ns or nam to see whether your installation succeeded.

NS-2.35 in Ubuntu 12.04 LTS -Long Term Support

To install ns2 in Ubuntu 12.04, same step as done in Ubuntu 11.10

Download NS-23.5 from http://www.isi.edu/nsnam/ns/

Go to terminal and install the necessary updates using the command “sudo  apt-get update”  (without Quotes)
Then install the ns2 required libraries using the command “sudo apt-get install build-essential autoconf automake libxmu-dev” (without quotes)
Untar the downloaded ns-allinone-xxx.tar.gz file using the command “tar zxvf ns-allinone-2.35.tar.gz”
execute the commands one by one as given below
cd ns-allinone-2.35
./install
(You get the PATH information if the installation was successful, upon succeeding set the PATH in the relevant file .bashrc)

Type ns and see a  % symbol indicates that the installation of ns2 is successful and also try the command  nam so that a network animator will be opened.

For any doubts, please raise a comment in the following column. I am there to help you.
If you try to install ns2 which comes along with the synaptic package manager, you cannot write new modules and recompile it.
In that case, you need to use the above method of installation

NS2.35 in Fedora 16
Steps:'
Install Fedora using a DVD ISO (if you go for a CD iso, then you need to download lot of packages)
Download NS-2.35 from this website.
http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz/download
Unzip or untar it to any folder (recommended is /home/loginname) using the following commands one by one
tar zxvf ns-allinone-2.35.tar.gz
cd ns-allinone-2.35
./install
Once installed the PATH information will be shown in the screen.
Copy the PATH and LD_LIBRARY_PATH Variable to .bash_profile (see a dot in the beginning)
Input the path information in .bash_profile like this
There will be a PATH Variable already available in the .bash_profile file, just copy the PATH information from the NS2 installation and append it over the existing PATH variable (but put a separator : between each path)
export PATH=$HOME/bin:<Put a colon and Place your paths here>
export LD_LIBRARY_PATH=<place the LD_LIBRARY_PATHS> here.
Once done, save the file and close
execute the command
source .bash_profile
try ns (if you see a % indicates ns is installed successfully) or nam (a animation window will be opened).
 NS 2.35 In Fedora 15
Download ns-allinone-2.35 from the NS2 website. The recent version was RC8
select the folder /home/username, untar the file using the command "tar zxvf ns-allinone-xxx.tar.gz" (without quotes).
Go to the folder /home/username/ns-allinone-2.35/ using the command cd  /home/username/ns-allinone-2.35 /  and execute the command ./install (dot /install)
You may encounter an error in the file mac_80211Ext.h and correct the error given in the following line
Open the file /home/username/ns-allinone-2.35/ns-2.35/mac/mac_80211Ext.h and include the following line in the header file area
#include <cstddef>
Go to step3 and type ./install 
Once installation completed, set the path information in .bash_profile (dot bash_profile). you need to set two path variables PATH and LD_LIBRARY_PATH
  
Edit this similar fashion with corresponding version of fedora 15 which u have installed "packages version - octl, tcl, nam, tk,
Now go to /etc folder and type

gedit ~/.bashrc

Add the following lines to the end of it. Remember replace "/your/path" by something like "/home/vina". And accordingly also change the version numbers. This is for ns 2.35.

# LD_LIBRARY_PATH
OTCL_LIB=/your/path/ns-allinone-2.35/otcl-1.13
NS2_LIB=/your/path/ns-allinone-2.35/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=/your/path/ns-allinone-2.35/tcl8.4.14/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

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

 NS 2.27 in Red hat

there are following steps: 
tar -xzf *
./install
change .bash_profile and add some environment variables. put /home/vinay/ns-allinone-2.27/bin:/home/vinay/ns-allinone-2.27/tcl8.4.5/unix:/home/vinay/ns-allinone-2.27/tk8.4.5/unix into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
IMPORTANT NOTICES:
(1) You MUST put /home/vinay/ns-allinone-2.27/otcl-1.8, /home/vinay/ns-allinone-2.27/lib,
 into your LD_LIBRARY_PATH environment variable.
 If it complains about X libraries, add path to your X libraries
 into LD_LIBRARY_PATH.
 If you are using csh, you can set it like:
 setenv LD_LIBRARY_PATH ....
 If you are using sh, you can set it like:
 export LD_LIBRARY_PATH=....
(2) You MUST put /home/vinay/ns-allinone-2.27/tcl8.4.5/library into your TCL_LIBRARY 
environmental variable. Otherwise ns/nam will complain during startup.
(3) [OPTIONAL] To save disk space, you can now delete directories tcl8.4.5
 and tk8.4.5. They are now installed under /home/vinay/ns-allinone-2.27/{bin,include,lib}
so , finally the bash_profile is like this:

PATH=$PATH:$HOME/bin:/home/vinay/ns2/ns-allinone-2.27/bin:/home/vinay/ns2/
ns-allinone-2.27/tcl8.4.5/unix:/home/vinay/ns2/ns-allinone-2.27/tk8.4.5/unix

export LD_LIBRARY_PATH=/home/vinay/ns2/ns-allinone-2.27/otcl-1.8:home/
vinay/ns2/ns-allinone-2.27/lib

export TCL_LIBRARY=/home/vinay/ns2/ns-allinone-2.27/tcl8.4.5/library

cd ns-2.27; ./validate
Note: The ns installation needs x-develop package. Otherwise, it will fail to build TCL TK.
Installation: A possible problem with CPP_NAMESPACE 
 ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile,
 ns-2.27/indep-utils/webtrace-conv/nlanr/Makefile, and
 ns-2.27/indep-utils/webtrace-conv/dec/Makefile,
 needed to be modified in order to fix a bug in ISI's distribution. The bug
 caused a compile-time error that looked like this:
 g++ -c -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@ -o setdest.o setdest.cc
 In file included from ../../../config.h:54,
 from setdest.h:5,
 from setdest.cc:57:
 ../../../autoconf.h:85: Error: namespace `CPP_NAMESPACE' undeclared
 setdest.cc:71:1: warning: "INFINITY" redefined
 In file included from /usr/include/math.h:40,
 from setdest.cc:43:
 /usr/include/bits/mathdef.h:35:1: warning: this is the location of the previous definition
 make[1]: *** [setdest.o] Error 1
 make[1]: Leaving directory `/home/iandow/netsim/ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest'
 make[1]: Entering directory `/home/iandow/netsim/ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/dec'
 To fix the bug, edit ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile and 
 change this line:
 DEFINE = -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@
 to this line:
 DEFINE = -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@ -DCPP_NAMESPACE=std
 In the other two makefiles, append -DCPP_NAMESPACE=std to CFLAGS.
 I discovered that fix by searching the NS news database[2] for
 "CPP_NAMESPACE".

ns2.34 in Fedora 8

Steps to Install ns2.34 in Fedora 8

Step 1:
Download ns-allinone-2.34.tar.gz from the following link
http://sourceforge.net/project/showfiles.php?group_id=149743&package_id=169689&release_id=684492

Step 2:
Execute the following commands to install ns2.34 from the terminal. You must login as root.

$cp ns-allinone-2.34.tar /opt/
$cd /opt/
$tar -xzf ns-allinone-2.34.tar.gz 
$cd ns-allinone-2.34
$./install

Step 3:
After a long wait and a whole lot of text, you should see the installation finish up with text like the following:

Please put /opt/ns-allinone-2.34/bin:/opt/ns-allinone-2.34/tcl8.4.18/unix:/opt/ns-allinone-2.34/tk8.4.18/unix into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.

IMPORTANT NOTICES:

(1) You MUST put /opt/ns-allinone-2.34/otcl-1.13, /opt/ns-allinone-2.34/lib, 
    into your LD_LIBRARY_PATH environment variable.
    If it complains about X libraries, add path to your X libraries 
    into LD_LIBRARY_PATH.
    If you are using csh, you can set it like:
                setenv LD_LIBRARY_PATH <paths>
    If you are using sh, you can set it like:
                export LD_LIBRARY_PATH=<paths>

(2) You MUST put /opt/ns-allinone-2.34/tcl8.4.18/library into your TCL_LIBRARY environmental variable. Otherwise ns/nam will complain during startup.

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

For trouble shooting, please first read ns problems page 
http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive for related posts.
Step 4:
To change PATH environment & others execute following commands in terminal.

$cd /etc
$gedit ~/.bashrc &

Step 5:
Add following lines at the end of bashrc file.

# LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ns-allinone-2.34/otcl-1.13:/opt/ns-allinone-2.34/lib

# TCL_LIBRARY
export TCL_LIBRARY=$TCL_LIBRARY:/opt/ns-allinone-2.34/tcl8.4.18/library

# PATH
export PATH=$PATH:/opt/ns-allinone-2.34/bin:/opt/ns-allinone-2.34/tcl8.4.18/unix:/opt/ns-allinone-2.34/tk8.4.18/unix

Step 6:
To make the change in the path & others permanent, type the following command in terminal.
$ source ~/.bashrc 

You can check what is written in your path by writing
$echo $PATH 
$echo $LD_LIBRARY_PATH 
$echo $TCL_LIBRARY

Step 7:
Now, the installation has been completed. If you try:
$ns 

Then a "%" will appear on the screen. Type "exit" to quit the mode.
Step 8:
You can test/validate the installation by doing the following: [It is not necessary]
$cd /opt/ns-allinone-2.34/ns-2.34/
$./validate
Note that this validation takes a really long time. If it starts out ok, you probably have a good installation.

Step 9:
Simple ns2 Simulation program

$cd /opt/ns-allinone-2.34/ns-2.34/tcl/ex
$ns wireless-demo-csci694.tcl
$nam 694demo.nam

If output comes, then everything is ok :)

Testing:
Way 1:

$ns
%set ns [new Simulator]
%$ns at 1 "puts \"Hello World!\""
%$ns at 1.5 "exit"
%$ns run


Way 2:

Step 1: Create a file named sample.tcl & add the following lines in the file.
set ns [new Simulator]
$ns at 1 "puts \"Hello World!\""
$ns at 1.5 "exit"
$ns run

Step 2: Run the file by executing following command
$ns sample.tcl

Step 3: Output will be: Hello World!

Step 3: Output will be: Hello World!
Installation References

1. http://nsnam.isi.edu/nsnam/index.php/Downloading_and_installing_ns-2
2. http://ns2-experience.blogspot.com/2008/01/d-day-installing-ns2.html
3. http://mobicomclass.wordpress.com/2008/06/17/installing-ns-2-on-fedora-8/
Tutorial References

1. http://www.isi.edu/nsnam/ns/tutorial/

Installing DCCP patch in ns2.34

Step 1:
Copy dccp-ns2.34.patch in /opt/ns-allinone-2.34/ns-2.34 folder.

Step 2:
Open the terminal and go to /opt/ns-allinone-2.34/ns-2.34 folder and execute all the commands.
$cd /opt/ns-allinone-2.34/ns-2.34
$patch -p1 <dccp-ns2.34.patch
$./configure
$make clean
$make
DCCP Patch References

1. http://eugen.dedu.free.fr/ns2/
2. http://sourceforge.net/projects/dccp-ns/files/
3. http://mohittahiliani.blogspot.com/2010/05/dccp-patches-for-ns-2.html

Install ns2.33 in fedora 12

cd ns-allinone-2.33
./install 

sudo gedit ~/.bashrc 
#environment values for NS2/NAM
# LD_LIBRARY_PATH
OTCL_LIB=/your directory/ns-allinone-2.33/otcl-1.13
NS2_LIB=/your directory/ns-allinone-2.33/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=/your directory/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/your directory/ns-allinone-2.33/bin:/your directory/ns-allinone-2.33/tcl8.4.18/unix:/your directory/ns-allinone-2.33/tk8.4.18/unix
NS=/your directory/ns-allinone-2.33/ns-2.33/
NAM=/your directory/ns-allinone-2.33/nam-1.13/
PATH=$PATH:$XGRAPH:$NS:$NAM 

source ~/.bashrc
cd ns-2.33
./validate

ERROR
now i cleared ns in installation.when i type ns whereever in commandpropt i can get %. but i m struggling with nam.when i type nam i got instruction like following.
[code omitted because of length]
: no event type or button # or keysym
while executing
“bind Listbox {
%W yview scroll [expr {- (%D / 120) * 4}] units
}”
invoked from within
“if {[tk windowingsystem] eq “classic” || [tk windowingsystem] eq “aqua”} {
bind Listbox {
%W yview scroll [expr {- (%D)}] units
}
bind Li…”

what steps should be follow to rectify this inconvinent "ERROR"
Requirements : # yum install \
libX11-devel libXext-devel libXau-devel libXmu-devel xorg-x11-proto-devel \ 
gcc-c++ compat-gcc-34-c++ make automake autoconf libtool

There may be something more to install, depending on version.
ns-allinone-2.3x also requires tk-8.4-lastevent.patch :

http://bugs.gentoo.org/attachment.cgi?id=161242
cd ns-allinone-2.34/tk-8.4.18/

patch -p0 < tk-8.4-lastevent.patch

Assume ns-allinone-2.34.tar.gz presence in /home/<user-name>/
tar xvf ns-allinone-2.34.tar.gz && cd ns-allinone-2.34/
&& ./install

ns-allinone-2.35-RC6 can also be recommended :
http://www.isi.edu/nsnam/dist/releas....35-RC6.tar.gz
http://www.isi.edu/nsnam/dist/release/ns-allinone-2.35-RC6.tar.gz
QUOTE : 
ns-allinone-2.3x also requires the tk-8.4-lastevent.patch :
http://bugs.gentoo.org/attachment.cgi?id=161242
..

cd ns-allinone-2.33/tk-8.4.18/
patch -p0 < tk-8.4-lastevent.patch

And run ./install again : Only tk4.8.18 and nam-1.xx will change,
and you should now get a 'nam' that works_

tk-8.4-lastevent.patch.txt
http://www.linuxquestions.org/questions/attachment.php?attachmentid=4166&d=1279693038

No comments:

Post a Comment