Hello, this post explains how to install ns2 in Ubuntu 18.04.
1) First you have to download ns2 all-in-one package from following link;
2) Extract the downloaded zip file 'ns-allinone-2.35.tar.gz file' to home folder.
3) Now you need to download some essential packages for ns2,these packages can be downloaded by using the following commands : applications>accessories>terminal or dashhome>terminal and then type the below lines one by one on the terminal window
- sudo apt-get update
- sudo apt-get dist-upgrade
- sudo apt-get update
4) Install the basic libraries;
- sudo apt install build-essential autoconf automake libxmu-dev
5) Install gcc and g++ and for that please do following;
open the file using sudo mode
- sudo nano /etc/apt/sources.list
Include the following line in list;
- deb http://in.archive.ubuntu.com/ubuntu bionic main universe
then open terminal and execute commands;
- sudo apt update
- sudo apt install gcc-4.8 g++-4.8
For NS2.35 you can use gcc and g++ version up to 5.4
if 4.8 isn't working try installing gcc-5 and g++5. then at the step where you modify the Makefile.in , use gcc-5 instead of gcc-4.8 and so on.
6) Navigate to the ns2 folder and modify the following make files.
- ~ns-2.35/Makefile.in
- Change @CC@ to gcc-4.8
- Change @CXX@ to g++-4.8
browse following files and replace everywhere as shown;
- ~nam-1.15/Makefile.in
- ~xgraph-12.2/Makefile.in
- ~otcl-1.14/Makefile.in
- change @CC@ to gcc-4.8
- change @CPP@ or @CXX@ to g++-4.8
Note: If you have a different gcc or g++ version, please change accordingly.
Now Open the following file: ~ns-2.35/linkstate/ls.h and change line no 137;
- void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
to
- void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }
7) Now change your directory and type the following codes in the command window to install NS2 from a new terminal.
- cd ns-allinone-2.35/
- ./install
The installation procedure will take a few minutes..........
8) For setting the path; Open a new Terminal and type
- gedit .bashrc
Paste the following lines
- export PATH=$PATH:/home/<username>/ns-allinone-2.35/bin:/home/<username>/ns-allinone-2.35/tcl8.5.10/unix:/home/<username>/ns-allinone-2.35/tk8.5.10/unix
- export LD_LIBRARY_PATH=/home/<username>/ns-allinone-2.35/otcl-1.14:/home/<username>/ns-allinone-2.35/lib
9) Save and close the text editor and then type the following command on the terminal
- source .bashrc
10) Close the terminal window and start a new terminal window and now change the directory to ns-2.35 and validate ns-2.35 by executing the following command ( it takes 30 to 45 minutes)
- cd ns-2.35
- ./validate
11) If the installation is successful, then you will be able to see % at the command prompt while typing the following command
- ns
12) Now type
- exit
Wonderful Blog post!!! I am more impressed with your data.
ReplyDeleteWhy Pointers are not Used in Java
Why Java Doesn't Support Pointers