step-to-install-ns2-ubuntu-16-04-digitalpadm

STEPS TO INSTALL NS2 ON UBUNTU 16.04

Posted by

STEPS TO INSTALL NS2 ON UBUNTU 16.04

NS2 is an open-source simulation tool that runs on Linux. It is a discreet event simulator targeted at networking research and provides substantial support for simulation of routing, multicast protocols and IP protocols, such as UDP, TCP, RTP and SRM over wired and wireless (local and satellite) networks. here i put up simple steps to install ns2 on ubuntu 16.04 Operating system. You can also find steps to remove or uninstall ns2 software.


Step 1:

Download NS2 (NS- 2.35) from here

It get downloaded into your ‘/home/your_user_name/Downloads’ directory.

Copy it to /opt folder by following command
cp  /home/user_name/Downloads/ns-allinone-2.35.tar.gz /opt/

Step 2:

Install Prerequisites

Type following commands on terminal

  1. sudo apt-get update
  2. sudo apt-get dist-upgrade
  3. sudo apt-get update
  4. sudo apt-get gcc
  5. sudo apt-get install build-essential autoconf automake
  6. sudo apt-get install tcl8.5-dev tk8.5-dev
  7. sudo apt-get install perl xgraph libxt-dev libx11-dev libxmu-dev

Step 3 :

Extract ns2
Type following commands on terminal

  1. tar -zxvf ns-allinone-2.35.tar.gz
  2. cd ns-allinone-2.35
  3. ./install

Step 4:

Open bashrc file to Set the Environment Variables
Type following commands on terminal

  1. sudo gedit ~/.bashrc

Copy the following lines at the end of the file.
# LD_LIBRARY_PATH
OTCL_LIB=/opt/ns-allinone-2.35/otcl-1.14/
NS2_LIB=/opt/ns-allinone-2.35/lib/
USR_Local_LIB=/usr/local/lib/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$USR_Local_LIB

# TCL_LIBRARY
TCL_LIB=/opt/ns-allinone-2.35/tcl8.5.10/library/
USR_LIB=/usr/lib/
export TCL_LIBRARY=$TCL_LIBRARY:$TCL_LIB:$USR_LIB

# PATH
XGRAPH=/opt/ns-allinone-2.35/xgraph-12.2/:/opt/ns-allinone-2.35/bin/:/opt/ns-allinone-2.35/tcl8.5.10/unix/:/opt/ns-allinone-2.35/tk8.5.10/unix/
NS=/opt/ns-allinone-2.35/ns-2.35/
NAM=/opt/ns-allinone-2.35/nam-1.15/
export PATH=$PATH:$XGRAPH:$NS:$NAM
#—-

Type following commands on terminal

  1. source ~/.bashrc

Type following commands on terminal

  1. ns

If you received the “%” sign, it means that NS is running correctly !


Steps to uninstall ns2

Delete the directory ‘ns-allinone-2.35’.

Delete the ns related files from ‘/user/local/bin’.

Edit the ‘.bashrc file’ and remove the paths that you have added during the installation.

Restart the system and run following commands one by one

sudo apt-get autoremove

sudo apt-get clean

Thanks !

Related Topics :

Easiest Steps to Install NS3 on Linux Ubuntu 16.04 OS

How to Solve Segmentation Fault Core Dumped Error | Stack Smashing Attack | Debug Program in Ubuntu


It's only fair to share...Share on FacebookShare on Google+Tweet about this on Twitter