Download the “ns-2”, “otcl”, “Tclcl” and “nam” packages separately.

Login as “root” in RHEL 6.

Extract the tarballs on the Desktop by following commands:

#  cd  Desktop

#  tar  -xvzf  [package name]

Install following packages from repository:

gcc  autoconf  automake  libXmu  tcl  tk

Installing otcl:

#  cd  [otcl directory]

#  ./configure

#  vi  Makefile

Edit line no. 31

INST_OLIBSH=               NONE/lib

to

INST_OLIBSH=               /usr/local/lib

#  make

#  make  install

Installing tclcl:

#  ./configure

#  make

#  make  install

Installing ns-2:

#  ./configure

#  make

#  make  install

#  echo  ‘ export  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib: ‘  >  /etc/profile.d/ns.sh

#  chmod  733  /etc/profile.d/ns.sh

Installing nam:

#  ./configure

#  make

#  make  install

Now perform a reboot of the system.

You can Validate the ns2 install (optional) (takes very long time):

#  cd  ns-2.35

#  ./validate

Now run the ns:

#  ns

If the installation is successful, then you will see % at the command prompt:

%

To exit, type:

%  exit

Testing the ns2 installation:

Open gedit and type the following hello world program:

set  ns  [new Simulator]
$ns  at  1  “puts  \“Hello World\””
$ns  at  1.5  “exit”
$ns  run

Save the file as helloworld.tcl and type the following command:

#  ns  helloworld.tcl

It displays the output as follows:

Hello World

Now your ns2 installation is complete and running.

Advertisements