less..
Download ns-allinone-2.31 and Install $ wget http://nchc.dl.sourceforge.net/sourceforge/nsnam/ns-allinone-2.31.tar.gz
$ tar -xzvf ns-allinone-2.31.tar.gz
$ cd ns-allinone-2.31
$ sudo apt-get install build-essential autoconf automake libxmu-dev
$ ./install
(If this fails, restart your computer and try the following step before ./install:)
$ sudo apt-get install -f build-essential libxt-dev libxt6 libsm-dev libsm6 libice-dev libice6 libxmu-dev
Set environment variables $ gedit ~/.bashrc
Add the following lines to the end of it. Remember replace "/your/path" by something like "/home/purple"
# LD_LIBRARY_PATH
OTCL_LIB=/your/path/ns-allinone-2.31/otcl-1.13
NS2_LIB=/your/path/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=/your/path/ns-allinone-2.31/tcl8.4.14/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/your/path/ns-allinone-2.31/bin:/your/path/ns-allinone-2.31/tcl8.4.14/unix:/your/path/ns-allinone-2.31/tk8.4.14/unix
NS=/your/path/ns-allinone-2.31/ns-2.31/
NAM=/your/path/ns-allinone-2.31/nam-1.13/
PATH=$PATH:$XGRAPH:$NS:$NAM
Let it take effect immediately:
$ source ~/.bashrc
Note: the step described above is important;otherwise, you cannot run ns successfully.
(or you can restart your X windows,i.e. logout and then login, or reboot your system, to make it work.)
Now,the installation has been completed.If you try:
$ ns
Then a "%" will appear on the screen.type "exit" to quit the mode and back to "$"
Validation
After these steps, you can now run the ns validation suite with
$ cd ns-2.31
$ ./validate
Next step ?
You might need a good tutorial to move forward:
Marc Greis's tutorial
Possible error messages
If you typed "ns" and got the following:
The program 'ns' is currently not installed. You can install it by typing:
sudo apt-get install host '''(don't do this)'''
Make sure you have the 'universe' component enabled
bash: ns: command not found
It probably means the environment variables haven't been set correctly. Make sure the ~/.bashrc file has been edited correctly and that it has either been source'd as described above or that the system has been rebooted.
less..