본문 바로가기
Simulation

How to install ns-2.34 on Ubuntu 9.10

by R히아신스 2011. 3. 5.

 


 

 



If you are planning to install the latest ns-2.34 on Ubuntu 9.10 Karmic Koala, here are some basic steps

1. Download ns-allinone-2.34.tar from here.

2. Place it in somewhere, e.g. /home/simulator, then extract it.
$ cd /home/simulator
$ tar -xvf ns-allinone-2.34.tar


3. Download & install some packages from repository
$ sudo apt-get install build-essential autoconf automake libxmu-dev

4. Install the ns2
$ cd ns-allinone-2.34
$ ./install


5. You might face problem with the installation of otcl-1.13, the problem can be due to the gcc-4.4.1 / g++-4.4.1 compilers. But please try this :

sudo apt-get install g++-4.3
CC=gcc-4.3 CXX=g++-4.3 ./install


try to edit the Makefile.in too

From :
CC= @CC@

to :
CC= gcc-4.3


6. Edit some paths ==a
$ gedit ~/.bashrc

Put these lines on that file. Off course, you might change /home/simulator for it depends on where you extract ns-allinone-2.34.tar.
# LD_LIBRARY_PATH
OTCL_LIB=/home/simulator/ns-allinone-2.34/otcl-1.13
NS2_LIB=/home/simulator/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/simulator/ns-allinone-2.34/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/home/simulator/ns-allinone-2.34/bin:/home/simulator/ns-allinone-2.34/tcl8.4.18/unix:/home/simulator/ns-allinone-2.34/tk8.4.18/unix
NS=/home/simulator/ns-allinone-2.34/ns-2.34/
NAM=/home/simulator/ns-allinone-2.34/nam-1.13/
export PATH=$PATH:$XGRAPH:$NS:$NAM


7. Validate it
$ cd ns-2.34
$ ./validate


7. (Optionally) You can create a symlink, so that ns can be called from everywhere
$ sudo ln -s /home/simulator/ns-allinone-2.34/ns-2.34/ns /usr/bin/ns

8. Try to run it.
$ ns