Tag Archives: ubuntu 12.04

[GUIDE TO] Configuring ns-2.34 with Eclipse Galileo in Ubuntu 12.04

Hi Folks,

In this post I shall explain about how to configure ns-2.34 with Eclipse Galileo. I faced certain problems while configuring ns-2.34 with eclipse as after successful configuration ns-2.34 would compile with errors. This gave me headaches and after lot of working around I found the correct method. So this guide would configure ns-2.34 with eclipse and ns-2.34 would build and compile without giving any errors.

Operating System   : Ubuntu 12.04
Network Simulator v: ns-2.34

Note: Hope u have downloaded and installed ns-allinone-2.34 fixed and patched by me. If you have not u can follow the guide <here>.

First of all in order to run eclipse u need to set up a JAVA environment on your UBUNTU 12.04. Three easy commands in the terminal will set it up for u, if JAVA environment is not present on your Ubuntu.

Open Terminal using Ctrl + Alt + T. And enter the following commands one after the another..

sudo apt-get install openjdk-7-jre
sudo apt-get install openjdk-7-jdk
sudo apt-get install icedtea6-plugin

This setups a Java environment for you.

Step 1) Download Eclipse Galileo (Eclipse IDE for C/C++ developers) from the eclipse website. Or u can download it from <here>.
U also need to download the CDT plugin for Eclipse. U can download it from <here> or from eclipse website.

Step 2) Extract eclipse in the home directory by right clicking on the file eclipse-cpp-galileo-linux-gtk.tar.gz and selecting open with archive manager. Now extract it using the extract button in the home directory. After extraction a directory with the name eclipse should be created in your home directory.

Step 3) Now right click on the file (i.e. the CDT plugin downloaded) cdt-master-6.0.2.zip and select open with archive manager. Now extract it using the extract button on top. Note: When u extract it, extract it inside the eclipse directory created earlier in your home directory and not anywhere else.

Step 4) Now open the eclipse folder and run eclipse. It will ask to select a workspace. Browse to the ns-allinone-2.34 directory in your home folder and select it. U can also make it default and set it to not ask each and every time u start eclipse.

Step 5) After eclipse opens. Browse to File –> New –> C++ Project.

Step 6) A window will open asking u to create a C++ Project. (Now u need to be careful)
In the Project Name field enter ns-2.34. It shall prompt that a directory/project with that name already exists. Ignore it.
Now under the Project Type. Select MakeFile Project.
And Under MakeFile Project. Select Empty Project.
Now Under the ToolChains section (on the right). Select Linux GCC.
And press Next.

Step 7) Now ns-2.34 will be added under your projects listing. To the left of the eclipse window.
Now go to Project –> Build All (It shall build without any errors.)
Now go to Project –> Clean and select ns-2.34 and press OK. (It shall compile without any errors).
Now go to Run –> Run (A % sign should appear on the console below).

[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.