Installing ns-2.35 in Ubuntu 12.04, 12.10, 13.04, 13.10 and 14.04

Tutorial to install ns-2.35 on Ubuntu 12.04/10 and 13.04/10

please follow the tutorial step by step

Step 1:


Download NS-2.35 (http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz/download)

Step 2:

place this file ns-allinone-2.35.tar.gz in any folder you like (recommended is /home/loginname) 

Step 3:

Run this command in terminal
( first go to the directory where you have put you ns-allinone-2.35.tar.gz file. )


tar zxvf ns-allinone-2.35.tar.gz (extracts the .tar.gz files content to a folder in the same directory name ns-allinone-2.35)

Step 4:

Run these command in terminal (Requires Internet)

sudo apt-get update ( means you need to keep your pc sources updated )
sudo apt-get install build-essential autoconf automake libxmu-dev (These are essential library files and size is around 17 MB)

Step 5:

Run this command in terminal 
 
cd ns-allinone-2.35 (get inside the ns directory)

Step 6: 

./install 

note:- the only error I got was something related to linkstate/ls.h.

So to resolve this issue do the following

execute command

sudo gedit  ns-allinone-2.35/ns-2.35/linkstate/ls.h 

on line number 137 change 

void eraseAll() { erase(baseMap::begin(), baseMap::end()); } 

to

void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }

Save and Close it.

Now again run ./install

after successful compilation you get ld_library_path an path ... read carefully !!!

Step 7:

This step is about how to save paths properly.
 
You will receive a three set of paths after successful
completion of install command.

these are path, ld library path and tcl library.

So to save them properly do the following:-

run cd .. ( this brings you back in home directory)

run gedit .bashrc (at last of the file add these paths in format given below)

export PATH=$PATH:path1:path2:path3 (Here paths should be separated by colon)


similarly for

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:path1:path2 (paths separated by colon)

and also for

export TCL_LIBRARY=$TCL_LIBRARY:path

Save and close it.
run source .bashrc (this loads the new .bashrc file)   

Type nam 

if you see nam window then great, installed successfully.

or else

post the error (note most of the mistakes happen in the last step i.e. saving paths).

Comments

Unknown said…
export PATH=$PATH:path1:path2:path3( means paths should be separated by colon)

similarly for

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:path1:path2:path3( means paths should be separated by colon)

save and exit,

where i do all this things
Anand Kumar said…
at the last of .bashrc file...

its the part of step 7 ... read again...

whenever we install a new software in ubuntu through cmd line ... and our new software contains some custom commands like ns or nam ... then we need to add them to .bashrc file so that our cmd prompt can recognize that custom command by taking the paths we give....

and after successful completing of step 6 ... u will receive some paths ... those are the paths and are in order like path 1 path 2 etc....

hope you would use a little of your head this time...
Unknown said…
how to save path and ld_library paths

Anand Kumar said…
read step 7 again...
Mathi said…
I want to install tcl and gcc for ns2.. Post commands for that tooo...
I installed ns2 successfully. Thanks a lot :)
Unknown said…
bash: export: `/home/salma/ns-allinone-2.35/otcl-1.14,': not a valid identifier
bash: export: `/home/salma/ns-allinone-2.35/lib': not a valid identifier
bash: fg: no job control

? is my path correct ?
Unknown said…
export PATH=$PATH:/home/salma/ns-allinone-2.35/bin:/home/salma/ns-allinone-2.35/tcl8.5.10/unix:/home/salma/ns-allinone-2.35/tk8.5.10/unix

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: /home/salma/ns-allinone-2.35/otcl-1.14:/home/salma/ns-allinone-2.35/lib

%export TCL-LIRARY=/home/salma/ns-allinone-2.35/tcl8.4.11/library
Anand Kumar said…
TCL is installed automatically while installing ns2

and gcc is by default installed in ubuntu 12.10
Anand Kumar said…
your path is correct just one update needed i.e.

1. remove space before colon (like ....LD_LIBRARY_PATH:/home/salma/...)

source .bashrc

and type ns (% symbol means success)

exit

Unknown said…
thank you so much for your brief guide
sukha said…
thanks bro...for this useful information
will this steps work for ns2.34 in ubuntu 12.10
Anand Kumar said…
cant say anything... havent tried... install ns 2.35 ... its the latest one.... i have provided link for it...
anurag said…
Good evening sir!
I tried installing ns2.34 & ns2.35 on ubuntu 12.10 without internet.
Is it possible to install without internet?
If yes then how?
If not then why it cant be installed without internet connection.
Thanks in advance
Anand Kumar said…
my dear I m a student only so stop saying sir...

and yes you can install ns2 without internet but you need to download the libraries which are present in your second command i.e.

sudo apt-get install build-essential autoconf automake libxmu-dev

but you need to install it manually...

these four libraries can be found also through synaptics package manager

hope this helps ....

anurag said…
Alright Anand !
I mistyped 12.10 instead of 12.04!
I dont have permission in my college to download anything!
I have ubuntu 12.04 in college!
If i have to install ns-2.35 on ubuntu 12.04 without internet facility!
What should I do for doing the same!
What should I download at home apart from ns all in one package!
Thanks!
Anand Kumar said…
darling haven't tried myself ever...
but you can search for all the four libraries above and procedure to install them..

yes you can do but you need to work a little.
anurag said…
Thanks Anand...just begun to work on linux...
hope I can do it quickly!
My friend told me about this blog!
He was right in praising you!
Also do you have any idea about how to make few nodes as black hole in tcl script?
Also how to identify them & remove them !
Thank you very much !
Cheers buddy!!
Anand Kumar said…
what do you mean by saying black hole for a node... please elaborate
anurag said…
Black Hole Attack in Networking basically occurs when a node particiaptes in data transmission act as forwarder .It receives data from the sender and replies it sent the data without sending it to receiver. it does not know any path , simply its goal to drop the packet data. In receive request function of .cc file there it directly reply the packet with highest sequence number to the source and the when data received it will drop these data at recv function of .cc file in the AODV.
Anand Kumar said…
sorry dude... dont have this much in depth knowledge.
Meerob said…
Hey, Anand. I have installed it successfully last time, but for my project its ns2.33 that I should install. Would you tell me how to uninstall ns2.35 and install ns2.33. thank you
Unknown said…
anand kumar i need ur help i am facing problem in this command
./setdest -v 1 -n 50 -p 0 -M 20 -t 900 -x 1500 -y 300 > out.txt
but there is an error occured
bash: ./setdest: no file or directry
i have ns2.35 simulator and setdest folder and make file are included in it plzz tell me the set by set procedure for running this command i will be v thankful to u
Anand Kumar said…
no idea boss... sorry
Unknown said…
I got tis problem
E: Package 'autoconf' has no installation candidate
E: Package 'automake' has no installation candidate
E: Package 'libxmu-dev' has no installation candidate
Unknown said…
in step 6 /ns-allinone-2.35$ ./install got numerous errors any help maybe i putted the step in a wrong way
Anand Kumar said…
Post the error details, will see into it once.
Unknown said…
hello, i find a problem in ns2 v2.35 installation: "Tcl is not part of the ns object".
please, is there some solutions??
Unknown said…
If you cant open or find the file .bashrc you can download the file ns2.sh from the following site http://linuxexpert.in.
Then you can edit your library paths from there. As for me i just downloaded it and save it in my home folder and my installation went on well.
ELSE THANKS TO THE POST UPLOADER. MAKEKE (cakes)
Unknown said…
Hello... I installed ns2.35 successfully in Ubuntu 14.04 64bit. If i enter ns in my terminal window, I am getting % symbol and if i enter nam in my terminal window, I am getting segmentation fault (core dumped) message. What should i do now to run nam?
Anand Kumar said…
check your nam file variable and recheck the whole step 7.
Anonymous said…
hello...while installing ns2 i got error :
./install

bash. / : Permission denied.
please help me how to solve this
Vikas Badgujar said…
I have followed the steps given by you and in 7th step i have given path as

export PATH=$PATH:/home/vikas/Documents/ns-allinone2.35/bin:/home/vikas/Documents/ns-allinone2.35/tcl8.5.10/unix:/home/vikas/Documents/ns-allinone2.35/tk8.5.10/unix
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/vikas/Documents/ns-allinone2.35/otcl-1.14/home/vikas/Documents/ns-allinone2.35/lib
export TCL_LIBRARY=$TCL_LIBRARY:/home/vikas/Documents/ns-allinone2.35/tcl8.5.10/library

when I type nam it give me an error Segmentation fault (core dumped)
Unknown said…
thank yoouu soo much!
appreciate your work!
Anonymous said…
dell@dell-Inspiron-3521:~/Desktop/ns-allinone-2.35$ cd ..
dell@dell-Inspiron-3521:~/Desktop$ cd ..
dell@dell-Inspiron-3521:~$ gedit .bashrc
dell@dell-Inspiron-3521:~$ source .bashrc
bash: /home/dell/Public/ns-allinone-2.35/otcl-1.14/home/dell/Public/ns-allinone-2.35/lib: No such file or directory
bash: /home/dell/Public/ns-allinone-2.35/tcl8.5.10/library: No such file or directory
bash: export: `/home/dell/Desktop/ns-allinone-2.35/lib,': not a valid identifier
dell@dell-Inspiron-3521:~$ cd Desktop/
dell@dell-Inspiron-3521:~/Desktop$ source .bashrc
bash: .bashrc: No such file or directory
dell@dell-Inspiron-3521:~/Desktop$ cd ..
dell@dell-Inspiron-3521:~$ source .bashrc
bash: /home/dell/Public/ns-allinone-2.35/otcl-1.14/home/dell/Public/ns-allinone-2.35/lib: No such file or directory
bash: /home/dell/Public/ns-allinone-2.35/tcl8.5.10/library: No such file or directory
bash: export: `/home/dell/Desktop/ns-allinone-2.35/lib,': not a valid identifier
dell@dell-Inspiron-3521:~$ ns
% exit
dell@dell-Inspiron-3521:~$ nam
Segmentation fault (core dumped)

Popular posts from this blog

Installing ns-2.35 on Mountain Lion, Mavericks, Yosemite and El Capitan (OS X 10.8/10.9/10.10/10.11)

Tutorial to implement protoname in ns2.35