1. Before proceeding to install NS2 and its packages, please ensure that you have already installed gcc, gdb, g++, and make.
sudo apt-get install build-essentials
* I spent a lot of time on finding the sources for build-essentials and finally :
deb http://fr.archive.ubuntu.com/ubuntu gutsy main
2. TCL / TK
mkdir ns2install
cd ns2install
sudo su
apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev stow
ln -s /usr/include/tcl8.4 /usr/include/tk8.4
ln -s /usr/include/tcl8.4/tcl-private/generic/* /usr/include/tcl8.4/
ln -s /usr/lib/tcl8.4/http2.4 /usr/lib/tcl8.4/http2.3
echo “/usr/local/lib” >> /etc/ld.so.conf
Sources.list : I find lots of campus list on http://wiki.ubuntu.org.cn
3. Download all the components required
wget http://jaist.dl.sourceforge.net/sourceforge/otcl-tclcl/otcl-src-1.12.tar.gz
wget http://nchc.dl.sourceforge.net/sourceforge/otcl-tclcl/tclcl-src-1.18.tar.gz
wget http://jaist.dl.sourceforge.net/sourceforge/nsnam/ns-src-2.30.tar.gz
wget http://jaist.dl.sourceforge.net/sourceforge/nsnam/nam-src-1.12.tar.gz
4. Install otcl
cd otcl-1.12
./configure --prefix=/usr/local/stow/otcl-1.12 --with-tk=/usr
make
mkdir -p /usr/local/stow/otcl-1.12/bin
mkdir -p /usr/local/stow/otcl-1.12/lib
mkdir -p /usr/local/stow/otcl-1.12/include
make install
cd /usr/local/stow/
stow otcl-1.12
ldconfig
4. Install tctcl
cd tclcl-1.18
./configure --prefix=/usr/local/stow/tclcl-1.18 --with-tk=/usr
make
mkdir -p /usr/local/stow/tclcl-1.18/include
mkdir -p /usr/local/stow/tclcl-1.18/bin
mkdir -p /usr/local/stow/tclcl-1.18/lib
make install
cd /usr/local/stow/
stow tclcl-1.18
ldconfig
5. Installing NS
tar -xzvf ns-src-2.30.tar.gz
cd ns-2.30
./configure –prefix=/usr/local/stow/ns-2.30 –with-tk=/usr
make
make test
mkdir -p /usr/local/stow/ns-2.30/bin
mkdir -p /usr/local/stow/ns-2.30/man/man1
make install
cd /usr/local/stow
stow ns-2.30
6. Install NAM
apt-get install libxmu-dev
tar -xzvf nam-src-1.12.tar.gz
cd nam-1.12
./configure –prefix=/usr/local/stow/nam-1.12 –with-tk=/usr
make
mkdir -p /usr/local/stow/nam-1.12/bin
make install
cd /usr/local/stow
stow nam-1.12
Thats all …. NS2 is done …..you can now start with the tutorials
1. http://www.isi.edu/nsnam/ns/tutorial
3. http://del.icio.us/thesandeep/AdHoc
An Example to test NS-2.30 on your system
download a simple file from here
and open a terminal, type
ns ns-simple.tcl
then the NAM (Network animator) automatically opens up.
(COURTESY: http://wiki.splitbrain.org/ns2 )