Thursday, August 29, 2013

Easy steps to install ns-2 in Ubuntu 12.04

For some reason I have started working in ns-2 again and I recently installed ns-2 on Ubantu 12.04LTS. I am writing this blog for the newbies in ns-2. 



Step -1
  • Install updates by typing command 'sudo apt-get update' on the terminal.
(You may get some errors, such as: Err http://kr.archive.ubuntu.com precise-updates/main Sources. Unable to connect to kr.archive.ubuntu.com:http:
….............. Ignore these errors for now)

  • Install some libraries with 'sudo apt-get install build-essential autoconf automake libxmu-dev' command.
Setp-2
  • Create a folder in home with name ns2.
  • Download ns-2.35 (ns-allinone package) from http://www.isi.edu/nsnam/ns/ns-build.html#allinone
  • Extract the ns-allinone-2.35.tar.gz file in the same folder by typing 'tar zxvf ns-allinone-2.35.tar.gz' in the terminal.
  • Go to the folder ns-allinone-2.35 with 'cd ns-allinone-2.35' command.
  • Type './install' command (or 'sudo ./install'

Sept -3
  • Now you can set the path as follows.
  • Type 'sudo gedit ~/.bash_aliases' command
  • Copy the following lines and paste to the gedit and save (Replace USER with your user name. To check where you are currently, you can use PWD command on the terminal.)
# LD_LIBRARY_PATH
OTCL_LIB=/home/USER/ns2/ns-allinone-2.35/otcl-1.14
NS2_LIB=/home/USER/ns2/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_LIB:$X11_LIB:$USR_LOCAL_LIB
# TCL_LIBRARY
TCL_LIB=/home/USER/ns2/ns-allinone-2.35/tcl8.5.10/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/home/USER/ns2/ns-allinone-2.35/bin:/home/joshi/ns2/ns-allinone-2.35/tcl8.5.10/unix:/home/USER/ns2/ns-allinone-2.35/tk8.4.10/unix
NS=/home/USER/ns2/ns-allinone-2.35/ns-2.35/
NAM=/home/USER/ns2/ns-allinone-2.35/nam-1.15/
PATH=$PATH:$XGRAPH:$NS:$NAM
Finally, type the command 'source ~/.bash_aliases'

Step Last

Check % sign appeared on the terminal after you type 'ns' and press enter on the terminal to check whether ns-2 is installed properly.

Some other readings might be (I did not read/watch all these though):
  • http://nsnam.com/2012/04/installing-ns-235-in-ubuntu-1204-lts.html
  • http://ramakrishnamundugar.blogspot.kr/2012/09/ns-234-installation-in-ubuntu-1204.html
  • http://www.youtube.com/watch?v=7_adyKXqbVU
  • http://pradeepkumar.org/2012/04/installing-ns-2-35-in-ubuntu-12-04.html
  • Also, don't forget to google for further help.

[Rule of thumb for learning simulation: DON'T ask question before you try.]

2 comments:

Anonymous said...

thank you :)

ali said...

wow, thanks for sharing