Wednesday, January 8, 2014

How To Install ns-2.32 in Linux OS

Step by Step Install ns-2.32 in Linux OS

Hi Friends this tutorial helps to how to install ns-2.32 in linux os . It is some what difficult for beginners and new members in linux , so that i have prepared step by step how to download and install a n2.32 allinonepacakge follow the below steps and install in ur system.


NS2 along with its supporting libraries and tools are available as ns-allinone package.

Note Do It in Super User (SU)

How To Install ns-2.32 in Linux OS

Step 1:  Open your Terminal(Console window)

Download ns-allinone-2.32 and Install

$ wget http://nchc.dl.sourceforge.net/sourceforge/nsnam/ns-allinone-2.32.tar.gz


Step 2:

Install the Packages also then only ns2.32 will work properly

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

Step 3: Unzip the ns-allinone-2.32.tar.gz

Use this command to unzip the files in your terminal 

$ tar -xzvf ns-allinone-2.32.tar.gz

$ cd ns-allinone-2.32 

Now run this command in terminal 

$./install 

Step 4:

After the successful installation, the path for bin, lib, Tcl, Tk and OTcl of the ns-allinone package has to be set by including the appropriate environment variables of bash shell in .bashrc file.

Step 5: NS2 Path Setting in Linux OS

after install ns-2 you should introduce ns-2 to your computer and edit the bash file in Terminal

$ gedit ~/.bashrc 

Add the following lines to the end of it. Remember replace “/your/path” by something like “/home/linuxhelpers”

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

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

Than it take effect immediately. $ source ~/.bashrc you should write command at the above, otherwise you can’t write ns2 successfully

Now, open new console and write ns, you will see % at the console. be carefully!!! You can see % after write ns at any path…by the way to exit from % you should write “exit” on your console.

Step 7: Validation

After these steps, you can now run the ns validation suite with

$ cd ns-2.32 $ ./validate 

After this process you can run some files from ns-allinone/ns-2.32/tcl/ex/…..tcl and see the results.

NAM
 when you run the tcl file if it generates a nam file you can trace it. HOW? go to path where is the tcl source code. than run your tcl code. and write “nam” on your console than small window will appear and click open file than choose your nam file and open it. after that you will see the simulation of your tcl code.

This ends the installation of ns-allinone package.

Step 8:
Finally check whether NS2 is Installed Properly in your system or not using the following Command in Terminal:
NS2
NAM
NS

How To Install ns-2.32 in Linux OS

No comments:

Post a Comment

Linux Tips and tricks,Online Linux Helpers