Install ns2 in ubuntu within few minutes

ns2 install in ubuntu within few minutes

Hi Friendssss.......Now You can Install NS2 in Ubuntu within Two Minutes..No tedious task of Changing environment and all etc.. U just Download the link(.rar file) Provided below.. and Extract the Files and Just Double click on them ..that's it Dudes.. now you have installed Ns2 in Ubuntu in two Minutes.. to got installed or not just go to terminal and type ns then you will get % Symbol just exit the terminal.. to run a Tcl file go to terminal and type ns now U can see the Nam animator.. Congratsssssssss....
Download Link................................................................

Now Try to run any example tcl file [You can get it]
download a file from that link.

Run a tcl file type the following command:

ns example-tcl-file.tcl


what can u see


wasting time for installing ns2 like this...........

Wasting of time:

As you know that ubuntu 9.10 is having lots of cool features and it's worth giving a try. But installing ns2 (The Network Simuator) through ns-allinone-2.3x package isn't easy on 9.10. While trying to install ns-allinone-2.3x, Firstly otcl doesn't compile with the latest gcc-4.4 (available with ubuntu 9.10). You need to compile it with gcc -4.3. If you get through this then also your problem is not solved, the ns-allinone-2.3x skips installing nam & xgraph as ubuntu 9.10 is not friendly with these packages available in ns-allinone-2.3x package.
I spent lots of time to fix this problem as one of my friend was doing his simulation on ns2 and finally ended up with an interesting lauchpad ppa for installing ns2 on Ubuntu.
Since Ubuntu 9.10 is already being shipped with tcl,otcl,tk... you need not to install these packages, Only ns, nam & xgraph are needed to install.
If you are behind a proxy, make sure you have $http_proxy variable configured in ~/.bashrc. [?]

Following are the simple steps to install ns2 on Ubuntu 9.10 through launchpad ppa.
1> Firstly remove all ns-allinone-2.3x directory (if you put it anywhere to install ns2) and revert back all the path changes you made in ~/.bashrc related to ns2.

2> Now export the Wouter Horré's ppa repository key by typing the following command on terminal and enter:
sudo apt-key adv --keyserver --recv-keys B3F3334F

3> Now add the following ppa repository to source list [?]
deb karmic main
deb-src karmic main
Reload repository information when prompted by "The information about available software is out-of-date" notification or reload it manually by following command on terminal:
sudo apt-get update
4> Now type the following command on terminal to install ns from the launchpad ppa repository:
sudo apt-get install ns nam xgraph
That's all. There is no need to set-up any path, environment variables or make any changes in ~/.bashrc .

Type ns to check:
you should see % at the command prompt (indicating successful installation)
Type exit if you get stuck with the %

Now Try to run any example tcl file [You can get it here]

To run a tcl file type the following command:
ns example-tcl-file.tcl

Hope this method would work for you. Just comment below whether you were successful in installation or if you face any problem.

Comments 47 comments

sushiltl profile image

sushiltl 6 years ago from MANCHESTER

hi dude that's gud start with hubpages

sachin 6 years ago

thnks a ton dude.....

rodger 6 years ago

hi mate

that's a good stuff, i hope so this could help in my project.

If you got more information about traffic, please update mate.

sara 6 years ago

i got error in step 3

No command 'deb' found, did you mean:

Command 'debc' from package 'devscripts' (main)

Command 'derb' from package 'libicu-dev' (main)

Command 'dab' from package 'bsdgames' (universe)

Command 'debi' from package 'devscripts' (main)

deb: command not found

can you help me please?

robotarm4 profile image

robotarm4 6 years ago Author

hi sara

just install all files not one after one it means that u need to install some last file first and after that other files.

install first 2 files and after that last 2 files zigzag way because they are not in order.

Sara 6 years ago

hi dear

yes now it is working

thanks a lot

best regards,


manoj 6 years ago

where will i find the ns2 directory if i have to change default tcl values.

I used first method


robotarm4 profile image

robotarm4 6 years ago Author

sorry manoj,

this files will install in os. There is no specific path for this ns2.

durga 6 years ago

really helpful

thank you

soumia 6 years ago

hi i have a pb when i recompil the ns?????,

pliiiiiiiiiiiz help me

robotarm4 profile image

robotarm4 6 years ago Author

hi soumia

what commands u have used for recompil????

just download the files from above link and just install all files. Then restart u r system.

IK 6 years ago

I followed this method and I was able to install ns 2.34 on Ubuntu 9.10. I thought all was well till I gt to the stage where I wanted to generate a node movement file. I set the parameters and all got was this error - bash: ./setdest: No such file or directory

I googled the error and somebody advised me to change the s parameter on the setdest to M and I did that but still got the same error.I installed g++ compiler, ran upgrades bt still got the same error. I found out that I could not run ./configure, ./make and ./install as all give errors. Pls I am confused as this has lingered. Who can help me out pls


robotarm4 profile image

robotarm4 6 years ago Author

if u want to install ns2.34 use this link and download a file, that document will show how to install.

lk use this link

robotarm 6 years ago

hi lk if u want to create file u need to type below command line

./setdest -n 20 -p 2.0 -M 10.0 -t 200 -x 500 -y 500 > scen-20-test

vipin 6 years ago

what shows the x graph. whatr shows the x-axis and wt shows y-axis.

robotarm4 6 years ago

hi vipin

Xgraph is the graphical presentation of the results i.e., from trace file where as x-axis and y-axis shows the positions of the nodes...

for graph u can use tracegraph file

ajay 6 years ago

hey i tried this method for ubuntu doesnt work....i get problem like...................

root@ajay-laptop:~# sudo apt-get install ns nam xgraph

Reading package lists... Done

Building dependency tree

Reading state information... Done

Package xgraph is not available, but is referred to by another package.

This may mean that the package is missing, has been obsoleted, or

is only available from another source

E: Package xgraph has no installation candidate

can anyone help me???

Sandy 6 years ago

won't work on 10.04

Sohail 6 years ago

Here is the procedure for 10.04 . It worked for me :

I spent a reasonably long time getting NS-2 (ns-allinone-2.34) to work in Ubuntu 10.04. Here’s how I finally did it:

1. Install necessary tools for building:

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

2. It turns out that otcl does not like the version of gcc installed by default in Lucid. So go ahead and change ns-allinone-2.34/otcl-1.13/ Find the line that says:

CC= @CC@

and change it to:

CC= gcc-4.3

3. Now try doing ‘./install’ from the ns-allinone-2.34 directory. It should work.

robotarm4 profile image

robotarm4 6 years ago Author

hi aswin,

can you install all files in zig zag way.

Mean first install last file and middle file.

(try to install remaining parts )

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.

    Click to Rate This Article