Installing Network Simulator 2 (NS2.34) in Ubuntu 11.04 9


Already this blog posts various titles on installing NS2 in Linux distros. Here is the step for installing in Ubuntu 11.04.

1. Version taken is NS2.34

2. Since ubuntu 11.04 uses GCC-4.5.2, there should be some minor tweeks.

3. Two files should be edited ~ns-2.34/tools/ranvar.cc and ~ns-2.34/mobile/nakagami.cc  as given in the following post

http://www.pradeepkumar.org/installing-ns-2-34-in-fedora-14.html

4. Install the following things in Ubuntu

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

sudo apt-get install gcc-4.4

5. open the file ~ns-2.34/otcl-1.13/configure and change the line number 6304 to SHLIB_LD=”gcc -shared” instead of SHLIB_LD=”ld -shared”

6. open the file ~ns-2.34/otcl-1.13/Makefile.in and change the line CC    @CC@ to CC    gcc-4.4

7. Set the path in /home/<name>/ .bashrc as in http://www.pradeepkumar.org/installing-ns2-under-ubuntu-910.html

8. After setting the path, sometimes overflow error may come when running ns and nam, so open the file ~ns-2.34/tcl8.X.x/unix/Makefile.in and in line number 270 change @CC@ to @CC@ –V 4.4

Thats it!!! NS2 Installed.

(Thanks to: http://erl1.wordpress.com/2011/05/12/installing-ns-2-34-on-ubuntu-11-04/)


About TS Pradeepkumar

I am a professor by profession and a learner by life. Working in VIT University, Chennai, India and love to code and do things in open source technologies. Though from electrical engineering, I am fond of doing things in Computing and its way.


Leave a comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

9 thoughts on “Installing Network Simulator 2 (NS2.34) in Ubuntu 11.04

  • Andresv17

    I have a problem. I have installed ns2 through Ubuntu Software Center because I couldn’t install with Terminal. It was impossible for me
    Now I have to install a patch for RSVP and I don’t know how. In all the tutorials I have saw, they go to the folder of ns2 and continue with the installation.

    The problem is that I don’t have a ns2 folder, all the files are spread in several folders.
    I don’t know what I have to do to install a patch in this case.

    Can somebody help me please?

    Send an email java1652_anva@hotmail.com

  • Omkar

    Hello Sir,
    I am using Ubuntu 11.04 Natty Nehwal version and tried installing ns2 version 2.34 following above instructions. After I was done with the complete procedure of setting the path in the .bashrc file I was NOT able to start ns2 or nam using the ns or nam command. It said that ns2 is not installed on this system and that use sudo apt-get install ns2 command to install it. It was the same case with nam.
    The lines added to the .bashrc file are:

    exportPATH=$PATH:/home/omkar/Downloads/ns-allinone-2.34/bin:/home/omkar/Downloads/ns-allinone-2.34/tcl8.4.18/unix:/home/omkar/Downloads/ns-allinone-2.34/tk8.4.18/unix
    exportLD_LIBRARY_PATH=/home/omkar/Downloads/ns-allinone-2.34/otcl-1.13,/home/omkar/Downloads/ns-allinone-2.34/lib

    After all this was done I used the sudo apt-get install for ns2 and nam both. Luckily enough both of them got installed and when I type ns or nam in the terminal it works but strangely the ./validate still fails and prints memory traces having Aborted labels because your above reply states that ns2 will run.
    Does it apply to my system as well or is there still a problem with the ns2 installation?
    Kindly Reply.
    Thank You.

  • TS Pradeepkumar

    hey omkar
    please check the PATH variable,
    there should be a space in between
    export PATH=
    and
    similarly
    export LD_LIBRARY_PATH=

    So if, you make a space between export and PATH and export and LD_LIBRARY_PATH, your problme will be rectified

    BTW, ubuntu11.04 comes with the predefined ns2 tool and you cannot recompile it that much easy, but still you can run tcl files and see the nam demo.

    better go with your own installation and succeed.