Anda di halaman 1dari 4

nstallation Procedure of NS2 in Ubuntu

Installing ns2.32 on Ubuntu7.10

This article works fine for Installing ns2.31 on Ubuntu 7.04 but for ns2.32 it needs some minor
changes so I will repeat the commands with these changes so that others may save time repeating
this work

Download ns-allinone-2.32 and Install

$ wget http://nchc.dl.sourceforge.net/sourceforge/nsnam/ns-allinone-2.32.tar.gz

$ tar -xzvf ns-allinone-2.32.tar.gz

$ cd ns-allinone-2.32

$ sudo apt-get install build-essential autoconf automake libxmu-dev

If an error raising Package autoconf is not available or something similar then this post may help
you for fixing that

(If previous command still generate some errors, and if it does, restart your computer and try the
following step :)

$ sudo apt-get install -f build-essential libxt-dev libxt6 \

libsm-dev libsm6 libice-dev libice6 libxmu-dev

If an error raising Package autoconf is not available or something similar then this post may help
you for fixing that

Now run this command

$./install

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.32/otcl-1.13

NS2_LIB=/your/path/ns-allinone-2.32/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.32/tcl8.4.15/library

USR_LIB=/usr/lib

export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH

XGRAPH=/your/path/ns-allinone-2.32/bin:/your/path/ns-allinone-2.32/tcl8.4.15/unix:/your/path/ns-
allinone-2.32/tk8.4.14/unix

NS=/your/path/ns-allinone-2.32/ns-2.32/

NAM=/your/path/ns-allinone-2.32/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.32 $ ./validate

2.
As you know that ubuntu 9.10 is having lots of cool features and it's worth giving a try. But
installing ns2 (The Network Simuator) through ns-allinone-2.3x package isn't easy on 9.10. While
trying to install ns-allinone-2.3x, Firstly otcl doesn't compile with the latest gcc-4.4 (available with
ubuntu 9.10). You need to compile it with gcc -4.3. If you get through this then also your problem is
not solved, the ns-allinone-2.3x skips installing nam & xgraph as ubuntu 9.10 is not friendly with
these packages available in ns-allinone-2.3x package.
I spent lots of time to fix this problem as one of my friend was doing his simulation on ns2 and
finally ended up with an interesting lauchpad ppa for installing ns2 on Ubuntu.
Since Ubuntu 9.10 is already being shipped with tcl,otcl,tk... you need not to install these packages,
Only ns, nam & xgraph are needed to install.
If you are behind a proxy, make sure you have $http_proxy variable configured in ~/.bashrc. [?]

Following are the simple steps to install ns2 on Ubuntu 9.10 through launchpad ppa.
1> Firstly remove all ns-allinone-2.3x directory (if you put it anywhere to install ns2) and revert
back all the path changes you made in ~/.bashrc related to ns2.

2> Now export the Wouter Horré's ppa repository key by typing the following command on
terminal and enter:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B3F3334F

3> Now add the following ppa repository to source list [?]
deb http://ppa.launchpad.net/wouterh/ppa/ubuntu karmic main

deb-src http://ppa.launchpad.net/wouterh/ppa/ubuntu karmic main

Reload repository information when prompted by "The information about available


software is out-of-date" notification or reload it manually by following command on
terminal:

sudo apt-get update

4> Now type the following command on terminal to install ns from the launchpad ppa
repository:
sudo apt-get install ns nam xgraph

That's all. There is no need to set-up any path, environment variables or make any changes in
~/.bashrc .

Type ns to check:
you should see % at the command prompt (indicating successful installation)
Type exit if you get stuck with the %
3.
These steps are specially required with NS2.34.

1. Download ns2.34 allinone to home;


If you have already got NS2.34, ignore this step.
2. tar -xvf it;
3. Open the Terminal and enter:
1. sudo apt-get install build-essential
2. sudo apt-get install libc6-dev g++ gcc
3. sudo apt-get install autoconf automake libxmu-dev
4. cd ns-allinone-2.34
5. ./install
4. If you receive a error:otcl-1.13 make failed! Exiting …,
Edit the ‘ Makefile.in ‘ in ns-allinone-2.34/ns-2.34/ from
CC = @CC@
CPP = @CXX@
to
CC = gcc-4.3
CPP = g++-4.3
then enter:
1. sudo apt-get install g++-4.3
2. CC=gcc-4.3 CXX=g++-4.3 ./install
3. #list all gcc edition installed
4. ls /usr/bin/gcc* -l
5. After above steps, you’ll need to change some Environment values in order to make your
program work correctly;
1. sudo gedit ~/.bashrc
Append below to .bashrc(change ‘your directory’ to your specific path);
#environment values for NS2/NAM
# LD_LIBRARY_PATH
OTCL_LIB=/your directory/ns-allinone-2.34/otcl-1.13
NS2_LIB=/your directory/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=/your directory/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/your directory/ns-allinone-2.34/bin:/your directory/ns-allinone-
2.34/tcl8.4.18/unix:/your directory/ns-allinone-2.34/tk8.4.18/unix
NS=/your directory/ns-allinone-2.34/ns-2.34/
NAM=/your directory/ns-allinone-2.34/nam-1.14/
PATH=$PATH:$XGRAPH:$NS:$NAM

2. source ~/.bashrc

6. Validate the installation process(optional ):


1. cd ns-2.34
2. ./validate

Anda mungkin juga menyukai