sudo apt update
sudo apt upgrade -Vy
Download NS2 & OLSR:
Extract NS2 & put it in Home:
cd ~
tar xzvf ~/Downloads/ns-allinone-2.35.tar.gz
Extract UM-OLSR & put it in NS2:
tar xzvf ~/Downloads/um-olsr-1.0.tgz
# Move UM-OLSR into NS2 & Reanme it to "olsr"
mv ~/um-olsr ~/ns-allinone-2.35/ns-2.35/olsr
Install Required Packages:
sudo apt install -Vy build-essential autoconf automake gcc
sudo apt install -Vy xorg-dev tcl-dev tk-dev perl xgraph libxt-dev libx11-dev libxmu-dev
cd ~/ns-allinone-2.35/
# File LinkStat
# Line 137
gedit ns-2.35/linkstate/ls.h +137
# Change "erase" to "this->erase", Save and Exist GEdit
Apply OLSR Patch:
cd ns-2.35/
patch -p1 < olsr/um-olsr_ns-2.35_v1.0.patch
cd ..
Install NS2 & OLSR:
./install
Put these lines at the end of ~/.bashrc
file:
gedit ~/.bashrc
Replace madooga
with your username(whoami
):
##### NS2 ####
# LD_LIBRARY_PATH
OTCL_LIB="/home/madooga/ns-allinone-2.35/otcl-1.14"
NS2_LIB="/home/madooga/ns-allinone-2.35/lib"
USR_LOCAL_LIB="/usr/local/lib"
export LD_LIBRARY_PATH="$OTCL_LIB:$NS2_LIB:$USR_LOCAL_LIB:$LD_LIBRARY_PATH"
# TCL_LIBRARY
TCL_LIB="/home/madooga/ns-allinone-2.35/tcl8.5.10/library"
USR_LIB="/usr/lib"
export TCL_LIBRARY="$TCL_LIB:$USR_LIB:$TCL_LIBRARY"
# PATH
XGRAPH="/home/madooga/ns-allinone-2.35/bin:/home/madooga/ns-allinone-2.35/tcl8.5.10/unix:/home/madooga/ns-allinone-2.35/tk8.5.10/unix"
NS="/home/madooga/ns-allinone-2.35/ns-2.35"
NAM="/home/madooga/ns-allinone-2.35/nam-1.15"
export PATH="$XGRAPH:$NS:$NAM:$PATH"
Run NS2:
ns ~/path/to/file.tk
a "source ~/.bashrc" should be run at the end, and addtionally an optional "./validate" too for it to work