ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer How-Tos & Tutorials

Install ns2 in ubuntu within few minutes

Updated on August 8, 2016

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 Check..it 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 example1.tcl.....wow...... now U can see the Nam animator.. Congratsssssssss....
Download Link................................................................

http://www.ziddu.com/download/16595972/NS2inUBUNTUin2minutes.rar.html

Now Try to run any example tcl file [You can get it http://www.cs.wm.edu/~njschm/research/NS2_Examples.html]
download a file from that link.

Run a tcl file type the following command:

ns example-tcl-file.tcl

..........





what can u see

rainbowssssssssssssss
rainbowssssssssssssss

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 keyserver.ubuntu.com --recv-keys B3F3334F

3> Now add the following ppa repository to source list [?]
deb http://ppa.launchpad.net/wouterh/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/wouterh/ppa/ubuntu 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

    0 of 8192 characters used
    Post Comment

    • profile image

      kostas 5 years ago

      i use ubuntu from usb stick!is this problem for running the ns 2?

      i write in terminal ns and it says this programme is not installed please press sudo apt-get install ns2.Please help me i have to do a project for my studies!me name on facebook is kwstas kaltsas if you want to connect with me!THX

    • profile image

      vinayak 5 years ago

      how to uninstall the above packages which i installed... i need access to aodv.cc file. or any other way...

    • profile image

      hyder 5 years ago

      hi friend,

      i check it out but in ubuntu 11.10 xgraph not working

      anu solution for this..

    • profile image

      nayana 5 years ago

      thank u it works

    • profile image

      supriya 5 years ago

      hi,

      m supriya.

      while installing Iv package from abover .rar file,it shows that"Error;Dependancy is not satisfiable: tcl8.4dev".

      how to resolve that?plz help me out

    • profile image

      prashant 5 years ago

      ,

      from /root/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.h:18,

      from /root/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.c:16:

      /root/ns-allinone-2.34/tk8.4.18/unix/../generic/tk.h:81:23: fatal error: X11/Xlib.h: No such file or directory

      compilation terminated.

      make: *** [tk3d.o] Error 1

      tk8.4.18 make failed! Exiting ...

    • profile image

      kiki002 5 years ago

      hi, I have problem with otcl-1.13 make failed! Exiting.. when i try to install gprs module for ns2.34

    • robotarm4 profile image
      Author

      robotarm4 5 years ago

      Hi zia,

      use "VMware software" to install ns software it will be easy for installing new softwares.

      sorry for late reply.

    • profile image

      Zia 5 years ago

      I want to remove NS2.33 to install NS2.29.I have installed NS2.33 by the above mentioned method.what should i do now to remove it.? kindly mail me on:

      engineer.zia68@gmail.com

    • profile image

      avinash_borse@yahoo.com 5 years ago

      Thx a lot this was real easy, but please help me out to install wimax patch on this ns2.........really hardpressed now

    • robotarm4 profile image
      Author

      robotarm4 6 years ago

      Hi hammad,

      this ns2 will install in ubuntu9.10

    • profile image

      hammad 6 years ago

      when I installed it the following error message is seen

      Wrong architecture 'i386'

    • profile image

      missybee 6 years ago

      Hi i'm having the same problem with Ik.. I want to generate random nodes movement so i tried to run this code:

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

      and this problem occured: couldn't read file "./setdest": no such file or directory

      can anyone help me solving this problem? I'm using Ubuntu 10.04 and ns2.34..

    • profile image

      S.ABLA 6 years ago

      hi,

      please help me to solve this problem

      when i try to install the NS2, this error appears:

      otcl.o: In function `OTclDispatch':

      /home/abla/ns-allinone-2.34/otcl-1.13/otcl.c:495: undefined reference to `__stack_chk_fail_local'

      otcl.o: In function `Otcl_Init':

      /home/abla/ns-allinone-2.34/otcl-1.13/otcl.c:2284: undefined reference to `__stack_chk_fail_local'

      ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn't defined

      ld: final link failed: Nonrepresentable section on output

      make: *** [libotcl.so] Error 1

      otcl-1.13 make failed! Exiting ...

      See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

    • robotarm4 profile image
      Author

      robotarm4 6 years ago

      hi uttam

      check this step 4 there is a problem with otcl try this steps once again and read those step uttam. The above file u have download is for new installation.

      Step 4:

      Here we got problem with otcl file which was not installating.

      Type this commands in terminal.

      $sudo apt-get install g++-4.3

      This file is installed because for NS-2.34 it requires g++ file.

      After installing g++, edit otcl Makefile.in

      $cd otcl-1.13

      gedit Makefile.in

      In that edit from CC= @CC@ to CC= gcc-4.3.

      $cd ..

      Then type installation again, it will install Ns2.34.

      $./install

    • profile image

      uttam 6 years ago

      i am able to run program.tcl but when i try to validate the ns2.34 it failed and when i followed the steps given in

      http://www.ziddu.com/download/10999136/installatio

      it gives error....

      ============================================================

      * Build OTcl-1.13

      ============================================================

      No .configure file found in current directory

      Continuing with default options...

      checking build system type... i686-pc-linux-gnu

      checking host system type... i686-pc-linux-gnu

      checking target system type... i686-pc-linux-gnu

      checking for gcc... gcc

      checking for C compiler default output file name... a.out

      checking whether the C compiler works... yes

      checking whether we are cross compiling... no

      checking for suffix of executables...

      checking for suffix of object files... o

      checking whether we are using the GNU C compiler... yes

      checking whether gcc accepts -g... yes

      checking for gcc option to accept ISO C89... none needed

      checking for g++... g++

      checking whether we are using the GNU C++ compiler... yes

      checking whether g++ accepts -g... yes

      checking how to run the C preprocessor... gcc -E

      checking for grep that handles long lines and -e... /bin/grep

      checking for egrep... /bin/grep -E

      checking for ANSI C header files... yes

      checking for sys/types.h... yes

      checking for sys/stat.h... yes

      checking for stdlib.h... yes

      checking for string.h... yes

      checking for memory.h... yes

      checking for strings.h... yes

      checking for inttypes.h... yes

      checking for stdint.h... yes

      checking for unistd.h... yes

      checking for string.h... (cached) yes

      checking for main in -lXbsd... no

      checking for socket in -lsocket... no

      checking for gethostbyname in -lnsl... yes

      checking for dcgettext in -lintl... no

      checking for getnodebyname in -ldnet_stub... no

      checking that g++ can handle -O2... no

      checking standard STL is available... no

      checking for tcl.h... -I../include

      checking for tclInt.h... -I../include

      checking for libtcl8.4... -L../lib -ltcl8.4

      checking for init.tcl... ../lib/tcl8.4

      checking for http.tcl... ../lib/tcl8.4/http1.0

      checking Tcl http.tcl library... yes

      checking for tclsh8.4.18... no

      checking for tclsh8.4... ../bin/tclsh8.4

      checking for tk.h... -I../include

      checking for libtk8.4... -L../lib -ltk8.4

      checking for tk.tcl... ../lib/tk8.4

      checking for X11 header files

      checking for X11 library archive

      checking for XOpenDisplay in -lX11... yes

      checking for XShmAttach in -lXext... yes

      checking for ranlib... ranlib

      checking for a BSD-compatible install... /usr/bin/install -c

      checking system version (for dynamic loading)... Linux-2.6.32-27-generic

      No explicit static compilation flag; setting V_STATIC to ""

      checking for dlopen in -ldl... yes

      checking for a BSD-compatible install... /usr/bin/install -c

      configure: creating ./config.status

      config.status: creating Makefile

      rm -f libotcl.so otcl.o so_locations

      gcc-4.4 -c -g -O2 -DNDEBUG -DUSE_SHM -fpic -I. -I/home/atul/ns-allinone-2.34/include -I/home/atul/ns-allinone-2.34/include -I/home/atul/ns-allinone-2.34/include -I/include otcl.c

      ld -shared -o libotcl.so otcl.o

      otcl.o: In function `OTclDispatch':

      /home/atul/ns-allinone-2.34/otcl-1.13/otcl.c:495: undefined reference to `__stack_chk_fail_local'

      otcl.o: In function `Otcl_Init':

      /home/atul/ns-allinone-2.34/otcl-1.13/otcl.c:2284: undefined reference to `__stack_chk_fail_local'

      ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn't defined

      ld: final link failed: Nonrepresentable section on output

      make: *** [libotcl.so] Error 1

      otcl-1.13 make failed! Exiting ...

      HELP ME PLZ..

    • profile image

      uttam 6 years ago

      i have solved the problems with yours erlier post.....

      thanx budy you have done great work.....THANKS a LOT..:)

    • profile image

      uttam 6 years ago

      i have solved the problems with yours erlier post.....

      thanx budy you have done great work.....THANKS a LOT..:)

    • profile image

      uttam 6 years ago

      hi after installing the ns2 i get following error when i compile the first.tcl

      i have saved it in desktop

      is it the problem due to not proper placing of file ......or something else....

      atul@atul-laptop:~$ ns first.tcl aodv

      couldn't read file "first.tcl": no such file or directory

      atul@atul-laptop:~$

    • profile image

      zuls 6 years ago

      Now is very easy to install NS2. We can install through ubuntu software centre

    • robotarm4 profile image
      Author

      robotarm4 6 years ago

      hi Hassan,

      this ns is only for running programs not for new routing protocol.

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

      And u can add new routing protocol.

      http://www.ziddu.com/download/10999136/installatio

    • robotarm4 profile image
      Author

      robotarm4 6 years ago

      hi ashwa

      which i have given ns2 is only for running programs. now I have give a link below has a tcl script which u can use for running a program by this u can get some graphical display.

      save below file and u can open with 'notepad' but u need to copy tcl script from that file save in other notepad, i.e, open new notepad and paste tcl script in notepad save it as 'first.tcl'

      .tcl format is important .

      And running this tcl script u need type

      'ns first.tcl aodv' in ns complier.

      And by this tcl script u can run with other routing protocols like dsr,dsdv,aomdv, etc. Just replace in ('ns first.tcl aodv') aodv with dsr, etc

      http://www.ziddu.com/download/12972768/first.txt.h...

    • profile image

      Hassan 6 years ago

      hi robotarm4,

      great job it's DONE

      can you help me please how can i use ns+Savi for satellite simulation ??

    • profile image

      ashwa 6 years ago

      hi

      i tried once again but i got the same error

      so if u have a file is ready to test plz, attach it, because the above one is expired.

      another question >> is there a method or command to run installed NS as GUI program then i can deal with it, like importing tcl files manually ???

      sorry, for asking more but i use it for my project.

      thanks once again for ur time

    • robotarm4 profile image
      Author

      robotarm4 6 years ago

      hi ashwa

      if u have a file dont give any space in between name of the file i.e, save file name as (savifile.tcl) not

      (savi file.tcl). And if u want run a program just type as ( ns filename.tcl )

    • profile image

      ashwa 6 years ago

      hi

      this method works perfectly for installation.

      but i don't know how to run NS2???,

      and i saved savi file.tcl and i tried to open it as your way it gives error "error when calling class OldSim: /home/user/Desktop/file.tcl"

      do you have any solution

    • profile image

      xqoid 6 years ago

      THANKS A LOT!!!

    • robotarm4 profile image
      Author

      robotarm4 6 years ago

      hi aswin,

      can you install all files in zig zag way.

      Mean first install last file and middle file.

      (try to install remaining parts )

    • profile image

      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/Makefile.in. 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.

      http://www.anand-iyer.com/blog/?p=22

    • profile image

      Sandy 6 years ago

      won't work on 10.04

    • profile image

      ajay 7 years ago

      hey i tried this method for ubuntu 10.04....it 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???

    • profile image

      robotarm4 7 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

    • profile image

      vipin 7 years ago

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

    • profile image

      robotarm 7 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

    • robotarm4 profile image
      Author

      robotarm4 7 years ago

      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

      http://www.ziddu.com/download/10999136/installatio...

    • profile image

      IK 7 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

      Ik

    • robotarm4 profile image
      Author

      robotarm4 7 years ago

      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.

    • profile image

      soumia 7 years ago

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

      pliiiiiiiiiiiz help me

    • profile image

      durga 7 years ago

      really helpful

      thank you

    • robotarm4 profile image
      Author

      robotarm4 7 years ago

      sorry manoj,

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

    • profile image

      manoj 7 years ago

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

      I used first method

      Thanks

    • profile image

      Sara 7 years ago

      hi dear

      yes now it is working

      thanks a lot

      best regards,

      Sara

    • robotarm4 profile image
      Author

      robotarm4 7 years ago

      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.

    • profile image

      sara 7 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?

    • profile image

      rodger 7 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.

    • profile image

      sachin 7 years ago

      thnks a ton dude.....

    • sushiltl profile image

      sushiltl 7 years ago from MANCHESTER

      hi dude that's gud start with hubpages