Ns2 Installation steps in ubuntu 12.04 / 13.10 / 14.04 (package NS2.35)
1. Firstly download the tar file of ns2.35 NS2 package (ns-allinone-2.35)
2. Copy that tar file in home path
3. Open terminal by ctrl+t
4. Type command on that is... sudo apt-get update
5. Then password your system...
6. Then type coomand... sudo apt-get install build-essential autoconf automake libxmu-dev.
7.Then type that command for extract the tar file... tar zxvf ns-allinone-2.35.tar.gz other wise you extract manually its your choice.
8.Then type on terminal .....cd ns-allinone-2.35
9.Then type the command ... gedit ns-2.35/linkstate/ls.h
(for changing the line 137...) is it
void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
its change by....that line
void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }
then paste that line on that program file linkstate -> manually also do that
10. Then type the command ./install on terminal.
11. After installation the ns2.35 then you will copy the path on the terminal
is....
Copy the PATH and LD_LIBRARY_PATH information in to your variable, you may use the /home/usr/.bashrc file and copy and paste the PATH and LD_LIBRARY_PATH.
Here you use command on another terminal is
vikasbro@ubuntu:~$ gedit ~/.bashrc
and post the following text into your bashrc file
and replace your path.. just like that
# LD_LIBRARY_PATH
OTCLLIB=/home/vikasbro/ns-allinone-2.35/otcl-1.14
NS2=/home/vikasbro/ns-allinone-2.35/lib
USR_LocalLIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCLLIB:$NS2:$USR_LocalLIB
# TCL_LIBRARY
TCLIB=/home/vikasbro/ns-allinone-2.35/tcl8.5.10/library
USRLIB=/usr/lib
export TCL_LIBRARY=$TCLIB:$USRLIB
# PATH
XGRAPH=/home/vikasbro/ns-allinone-2.35/xgraph-12.2/:/home/vikasbro/ns-allinone-2.35/bin:/home/vikasbro/ns-allinone-2.35/tcl8.5.10/unix:/home/vikasbro/ns-allinone-2.35/tk8.5.10/unix
NS=/home/vikasbro/ns-allinone-2.35/ns-2.35
NAM=/home/vikasbro/ns-allinone-2.35/nam-1.15
export PATH=$PATH:$XGRAPH:$NS:$NAM
12. After copy and paste then you type on terminal is ns if a% is show on terminal the ns2 is successfully install if not then problem is occurred so follow above steps carefully otherwise contact me...
13. Then Type on terminal nam the pop up window will be open for nam animator.
After installation plz comment or not install or error then ask ......
2. Copy that tar file in home path
3. Open terminal by ctrl+t
4. Type command on that is... sudo apt-get update
5. Then password your system...
6. Then type coomand... sudo apt-get install build-essential autoconf automake libxmu-dev.
7.Then type that command for extract the tar file... tar zxvf ns-allinone-2.35.tar.gz other wise you extract manually its your choice.
8.Then type on terminal .....cd ns-allinone-2.35
9.Then type the command ... gedit ns-2.35/linkstate/ls.h
(for changing the line 137...) is it
void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
its change by....that line
void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }
then paste that line on that program file linkstate -> manually also do that
10. Then type the command ./install on terminal.
11. After installation the ns2.35 then you will copy the path on the terminal
is....
Copy the PATH and LD_LIBRARY_PATH information in to your variable, you may use the /home/usr/.bashrc file and copy and paste the PATH and LD_LIBRARY_PATH.
Here you use command on another terminal is
vikasbro@ubuntu:~$ gedit ~/.bashrc
and post the following text into your bashrc file
# LD_LIBRARY_PATH |
OTCLLIB=/path/to/ns-allinone-2.35/otcl-1.14 |
NS2=/path/to/ns-allinone-2.35/lib |
USR_LocalLIB=/usr/local/lib |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCLLIB:$NS2:$USR_LocalLIB |
# TCL_LIBRARY |
TCLIB=/path/to/ns-allinone-2.35/tk8.5.10/library |
USRLIB=/usr/lib |
export TCL_LIBRARY=$TCLIB:$USRLIB |
# PATH |
XGRAPH=/path/to/ns-allinone-2.35/xgraph-12.2/:/path/to/ns-allinone-2.35/bin:/path/to/ns-allinone-2.35/tcl8.5.10/unix:/path/to/ns-allinone-2.35/tk8.5.10/unix |
NS=/path/to/ns-allinone-2.35/ns-2.35 |
NAM=/path/to/ns-allinone-2.35/nam-1.15 |
export PATH=$PATH:$XGRAPH:$NS:$NAM |
and replace your path.. just like that
# LD_LIBRARY_PATH
OTCLLIB=/home/vikasbro/ns-allinone-2.35/otcl-1.14
NS2=/home/vikasbro/ns-allinone-2.35/lib
USR_LocalLIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCLLIB:$NS2:$USR_LocalLIB
# TCL_LIBRARY
TCLIB=/home/vikasbro/ns-allinone-2.35/tcl8.5.10/library
USRLIB=/usr/lib
export TCL_LIBRARY=$TCLIB:$USRLIB
# PATH
XGRAPH=/home/vikasbro/ns-allinone-2.35/xgraph-12.2/:/home/vikasbro/ns-allinone-2.35/bin:/home/vikasbro/ns-allinone-2.35/tcl8.5.10/unix:/home/vikasbro/ns-allinone-2.35/tk8.5.10/unix
NS=/home/vikasbro/ns-allinone-2.35/ns-2.35
NAM=/home/vikasbro/ns-allinone-2.35/nam-1.15
export PATH=$PATH:$XGRAPH:$NS:$NAM
12. After copy and paste then you type on terminal is ns if a% is show on terminal the ns2 is successfully install if not then problem is occurred so follow above steps carefully otherwise contact me...
13. Then Type on terminal nam the pop up window will be open for nam animator.
After installation plz comment or not install or error then ask ......
Hi Vikas, I am stuck at 11. Can you guide me how to set the path. When i did the path command, and lastly run the ns command, a% is not shown. So i guess it didn't work.
ReplyDeleteDone with ns command...but when i run nam command, this is the error :
ReplyDeleteThis probably means that tk wasn't installed properly.
child process exited abnormally
settled as i browsed through the solution from the net...
ReplyDeleteCan you please share the solution for this issue. As im also facing the same issue with nam command. I am able to get % with ns command but nam gives "child process exited abnormally" error. Please help needed.
Deleteprovide the screen shoot error...
DeleteSry for late reply due to hell busy schedule
ReplyDeletei think you did not copy the path properly in your bashrc file..
Done, thank you for the post. Though it was not easy, especially in item 11. What readers should do here is that once after installation completed (in 10) they'l be given information regarding to the LD_LIBRARY_PATH, LD_LIBRARY_PATH and TCL_LIBRARY in the IMPORTANT NOTICE part (in terminal), they should copy this information and paste them as directed in .bashrc (sudo nano .bashrc), this will work !!
ReplyDeleteI clarify the 1oth and 11th steps again i hope that is helpful for you. If any problem faced please ask me
ReplyDeleteafter the whole installation when i check nam , it gives segmentation fault (core dumped), give me solution
ReplyDeleteSegmentation fault" means that you tried to access memory that you do not have access to. so its problem related to your pointer
DeleteHi Vikas i am installing ns2 software and i stuking at the last step i.e after % when i m writing nam they are saying "child killed: segmentation violation" so plese help me for this
ReplyDeletecopy the 'nam' file from your '/home/[username]/ns-allinone-2.35/nam-1.15' folder and paste it into '/usr/local/bin' folder now surely it will work... restart your terminal and execute your tcl script
DeleteHey vikas, I tried to copy the "nam" file from the folder but it showed some permission error. Also segmentation error was shown. Please guide me for this...
ReplyDeletehey using root user to use the the nam and ns2 file for copy and paste. If any extra file copy then configure ns2 again
Deletei my friend i wan to know about ns 2 pls help me
ReplyDeleteYes my friend post any problem regarding to NS2 i try my best to solve them @ Karthik Dakshinm...
Deletehiii dere,, m stucked,,,file u have mentioned dere linkstate/Is.h to edit....m not able to find this file neither by GUI nor by command through terminal,,,if i try to open this via gedit via terminal...file is empty,,,,
ReplyDeleteand also command "sudo apt-get install build-essential autoconf automake libxmu-dev"
gives an error package not found,,,,
sir please help
my system specification: ubuntu 12.04
Deleteand is fully updated
Can you follow all the above steps and where you stucked the problem please provide the screen shot.
Deleteubuntu 12.04 is ok for NS2.5
sir i have get segmentation fault error is coming how to resolve this problem...
ReplyDeleteDear V Dharm segmentation fault error accrue when pointer not linked that means you did not provide the path for nam on vi edit shell use my last steps carefully...
Deletesir i too got segmentation fault(core dumped) error while trying name command. how to solve it. please help me
ReplyDeletenam popup window not opening
ReplyDeleteDear Santhi Sri and unknown you also faced same problem segmentation fault error accrue when pointer not linked that means you did not provide the path for nam on vi edit shell use my last steps carefully...
ReplyDeletehi i am working on ns 2 software, trying to implement teen protocols...but couldnt get anywhere near the code , can u please share the code for the teen protocol
ReplyDeletehi!!! i am unable to open nam when i type nam
ReplyDeletegetting message that "segmentation fault(core dumped)"
what should i do??
hi!!! i am unable to open nam when i type nam
ReplyDeletegetting message that "segmentation fault(core dumped)"
what should i do??
segmentation fault(core dumped).i installed ns2 and nam from synaptic package.nam file is created but animater is not shown
ReplyDeletei am using ubuntu 16.04
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHello
ReplyDeleteI want to integrate mannasim with ns2.35 but when I run ./configure I got this error "Installation of tcl seems incomplete orcan't be found automatically" and I didn't find a solution to my problem please help me and thanks in advance
my nam pop up window is not opening
ReplyDeletebash: /usr/local/bin/nam: No such file or directory
ReplyDeletesir please help me out..when i put nam in terminal then this error occur..what i do..?
i followed all steps according to your post..
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi I did everything correct (ns and nam works fine) however when I try to execute xgraph commands, I get the following error:
ReplyDeleteSegmentation fault (core dumped)
Can you help me solve this problem?