Tag Archives: make clean

[GUIDE TO] Installing ns-2.34 (network simulator) in Ubuntu 12.04 LTS (specifically)..

Hi Folks,

Recently, I had been trying to install ns-2.34 in my ubuntu 12.04 which i have on a HP G62 pavilion notebook. Although i successfully installed it many a times but it was just a basic install (i.e. for a noob to work upon with basic tcl scripting and viewing simulations). Installing it completely without any compilation errors was the most challenging task as in order to modify ns2 u have to install it flawlessly.

In this post I shall teach you how to install ns-2.34 in ubuntu 12.04 (specifically).

First of all u need to download my version of ns-2.34 from the link given below. In this version of ns-2.34, I have made all the necessary changes (i.e. to Makefile and certain other files in ns-2.34 directory).

Download it from here.

The package is a complete ns-allinone-package with all changes done without the need of having u to make any further changes. If the following steps are followed in order u might get a full clean install of ns2.

Note : We shall install ns-2.34 in the home directory and no where else. So please copy the downloaded file in your home directory. And if u do not know where the home directory is u can google it 🙂 .

Step 1) Remove any previous ns2 versions installed on your OS

rm -rf /home/<your-homedirectory-name>/ns-allinone-2.34

instead of ns-allinone-2.34 u can put prior versions of ns2 if installed. And to find your home directory open terminal using Ctrl + Alt + T and then type pwd in it.

Step 2) After step 1, enter the following commands

sudo apt-get update

sudo apt-get install build-essential autoconf automake libxmu-dev libxt-dev libx11-dev xorg-dev xgraph gcc g++

The above command will install all necessary dependencies in order for ns-2.34 to run and install successfully.

Step 3) Now unzip the downloaded ns-allinone-2.34.tar.gz folder by right clicking on it and selecting open with archive manager and extract it in your home folder. Then open terminal using Ctrl + Alt + T.

Browse to the ns-allinone-2.34 directory by typing :

cd ns-allinone-2.34

now browse to ns-2.34 directory by typing :

cd ns-2.34

now type the following commands in order.

./configure

make clean

make depend

make

They should run successfully without showing any error. If you get any problems ask in comments.

Now go back to ns-allinone-2.34 directory by typing

cd ..

Now install ns-2.34 by typing

./install

It should install successfully. Now close the terminal by typing exit. If u get any errors ask in comments section.

Step 4) Now its time to setup your environment variables. This is the tricky part.

open terminal by pressing Ctrl + Alt + T. And enter the following command:

sudo gedit ~/.bashrc

bashrc file would open in gedit. At the end of the file add the following lines (Do it carefully)

# LD_LIBRARY_PATH
OTCL_LIB=/home/arya/ns-allinone-2.34/otcl-1.13
NS2_LIB=/home/arya/ns-allinone-2.34/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/arya/ns-allinone-2.34/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/home/arya/ns-allinone-2.34/bin:/home/arya/ns-allinone-2.34/tcl8.4.18/unix:/home/arya/ns-allinone-2.34/tk8.4.18/unix:/home/arya/ns-allinone-2.34/xgraph-12.1/
NS=/home/arya/ns-allinone-2.34/ns-2.34/
NAM=/home/arya/ns-allinone-2.34/nam-1.13/
export PATH=$PATH:$XGRAPH:$NS:$NAM

NOTE: change arya in the above paths to your home directory’s name. (DO NOT FORGET THAT).

Close the bashrc file. Log off and log in again.

Step 5) Now open terminal using Ctrl + Alt + T and type ns.

A % sign should appears and that marks a clean installation of ns-2.34.

Voila! Success.

In the next post, I shall write about configuring ns-2.34 in Eclipse (Galileo version) for development purposes and for modifying and compiling ns-2.34 from eclipse.