- Download ns-allinone-2.31 from sourceforge.net

- Un-tar the source file
- Install build-essential, autoconf, automake & libxmu-dev
- Run installation by using this script below. User should in ns-allinone-2.31 directory of ns-allinone

- Setting environment variable
Add this script bellow on your bashrc file (the last line), remember to rename "/home/nra" based on your computer name.
-------------------------------------------------------------------------------------------
# LD_LIBRARY_PATH OTCL_LIB=/home/nra/ns-allinone-2.31/otcl-1.13 NS2_LIB=/home/nra/ns-allinone-2.31/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/nra/ns-allinone-2.31/tcl8.4.14/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/home/nra/ns-allinone-2.31/bin:/home/nra/
ns-allinone-2.31/tcl8.4.14/unix:/home/nra/ns-allinone-2.31/tk8.4.14/unix
NS=/home/nra/ns-allinone-2.31/ns-2.31/
NAM=/home/nra/ns-allinone-2.31/nam-1.13/
PATH=$PATH:$XGRAPH:$NS:$NAM
----------------------------------------------------------------------------------------------------
Run this script to affect the setting
$source ~./bashrc
- Test NS2 installation, run this script. If '%' mark appear it mean your installation is complete. If not, you should reboot your system.
$%
- Validate NS2. Under directory ns-allinone-2.31/ns-2.31 run this script. It will take several time to complete the validation.
Reference : Alkautsarpens