Sunday, 28 June 2009

Installing NS2 on Cygwin

Download NS2 package from http://www.isi.edu/nsnam/ns/. For me, I just downloaded the allinone package. And the version is 2.33. Recently, 2.34 is released on June 17, 2009.

After downloading the file, put it under C:\cygwin\home\username. Then open bash shell by running the shortcut from the desktop or from the start menu. Go to home\username and run the command, "tar xvfz ns-allinone-2.33.tar.gz".

After extracting files, run ./install.

When the installation finishes, the files can be checked by using the command, ./validate.

Finally, .bashrc is needed to be changed a bit to add environment variables. It is located under C:\cygwin\home\username\.bashrc. I added the following lines at the end of the file.

# LD_LIBRARY_PATH
OTCL_LIB=/home/username/ns-allinone-2.33/otcl-1.13
NS2_LIB=/home/username/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=/home/username/ns-allinone-2.33/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

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

And that's it.

References

2 comments:

  1. Hello, I tried following the above steps to install ns2 2.33 using cygwin. During installation I encountered the following message:
    Checking for xorg-x11-bin...NO!

    And the installation stopped. Did you encounter this. If so, can you please let me know how to fix it. Thank you.
    Neil.

    ReplyDelete
  2. Hi, sorry for the late reply. I didn't notice I had a comment.

    I think xorg-x11-bin is missing in cygwin installation. Refer to my post on Preparing Cygwin for NS2 (http://my-hertz.blogspot.com/2009/06/preparing-cygwin-for-ns2.html). A list of packages has been made there which are needed to run NS2 on cygwin. Hope that helps.

    Rgds,
    Hz

    ReplyDelete