How to install ns2 on Red Hat Linux

The credit goes to Credits (original post)

To install ns 2.27 in Red hat, there are following steps: 

  1. tar -xzf *
  2. ./install
  3. change .bash_profile and add some environment variables. put /home/zhibinwu/ns-allinone-2.27/bin:/home/zhibinwu/ns-allinone-2.27/tcl8.4.5/unix:/home/zhibinwu/ns-allinone-2.27/tk8.4.5/unix into your PATH environment; so that you’ll be able to run itm/tclsh/wish/xgraph.
    IMPORTANT NOTICES:

    (1) You MUST put /home/zhibinwu/ns-allinone-2.27/otcl-1.8, /home/zhibinwu/ns-allinone-2.27/lib,
     into your LD_LIBRARY_PATH environment variable.
     If it complains about X libraries, add path to your X libraries
     into LD_LIBRARY_PATH.
     If you are using csh, you can set it like:
     setenv LD_LIBRARY_PATH ....
     If you are using sh, you can set it like:
     export LD_LIBRARY_PATH=....
    
    (2) You MUST put /home/zhibinwu/ns-allinone-2.27/tcl8.4.5/library into your TCL_LIBRARY environmental
     variable. Otherwise ns/nam will complain during startup.
    
    (3) [OPTIONAL] To save disk space, you can now delete directories tcl8.4.5
     and tk8.4.5. They are now installed under /home/zhibinwu/ns-allinone-2.27/{bin,include,lib}

    so , finally the bash_profile is like this:

    PATH=$PATH:$HOME/bin:/home/zhibinwu/ns2/ns-allinone-2.27/bin:/home/zhibinwu/ns2/ns-allinone-2.27/tcl8.4.5/unix:/home/zhibinwu/ns2/ns-allinone-2.27/tk8.4.5/unix
    
    export LD_LIBRARY_PATH=/home/zhibinwu/ns2/ns-allinone-2.27/otcl-1.8:home/zhibinwu/ns2/ns-allinone-2.27/lib
    
    export TCL_LIBRARY=/home/zhibinwu/ns2/ns-allinone-2.27/tcl8.4.5/library
  4. cd ns-2.27; ./validate

 

Note: The ns installation needs x-develop package. Otherwise, it will fail to build TCL TK.

Advertisement

30 Responses to How to install ns2 on Red Hat Linux

  1. i don’t how to put /home/zhibinwu/ns-allinone-2.27/otcl-1.8, /home/zhibinwu/ns-allinone-2.27/lib,
    into your LD_LIBRARY_PATH environment variable.
    If it complains about X libraries, add path to your X libraries
    into LD_LIBRARY_PATH?

    please help me…thanks

  2. hust make a file ns2.sh (give execution right by chmod +x ns.sh) copy the file in /etc/profile.d/ in this file write someting like this
    PATH=$PATH:
    LD_LIBRARY=$LD_LIBRARY:
    export PATH
    export LD_LIBRARY
    (iam not sure of two things 1. the sysntax and names define above (for that refer to earlier post on how to install ns2 on linux) 2. will this work in red hat or not (I usually use fedora)
    ELse Make me know I will try this on red hat or ask my pro friends, you can even search “how to set environment variable in redhat” to solve the problem or else I will try this for you

  3. pls tell me how add path , library path to instll ns2

  4. for setting path follow this steps (taken from this post)

    Step 6:Now it is the time for setting environment variable, Copy the message displayed after running the above commmand to a text file else copy and paste this in a new text file ===================================
    PATH=$PATH:/home/ns-allinone-2.31/bin:/home/ns-allinone-2.31/tcl8.4.14/unix:/home/ns-allinone-2.31/tk8.4.14/unix
    LD_LIBRARY_PATH=/home/ns-allinone-2.31/otcl-1.13:/home/ns-allinone-2.31/lib

    TCL_LIBRARY=/home/ns-allinone-2.31/tcl8.4.14/library
    export PATH
    export LD_LIBRARY_PATH
    export TCL_LIBRARY
    ================================

    Step 7:save the file as ns2.sh (later run chmod +x ns2.sh to make it executable)

    Step 8:copy the file into /etc/profile.d/

    Step 9: either restart the machine or relogin

    ================
    I am not sure this will work in red hat or not, but try and share your results with us, we will be glad to see you back

    All the best
    Ashwini Patankar

  5. i am new to linux as well as ns2 but i am going to work on ns2 for my thesis work so plz help me from scratch.

  6. Dear Babita,

    Welcome to the world of linux and ns2. Just follow the simple steps to install ns2 on yur machine. Search for some handy notes for using linux on net, I am sure you will get some. Follow the tutorial about ns2 , there are many choose wisely.
    And if you stuck with any problem, WirelessCafe Team is always there to help you out.

    Cheers !
    WirelessCafe Team

  7. Hi.

    This is very use ful for me but io have some proble in nam and xgraph if it is possiable hten plz gelp me

    …………………………..
    [bds@bds ~]$ nam
    nam:

    : no event type or button # or keysym
    while executing
    “bind Listbox {
    %W yview scroll [expr {- (%D / 120) * 4}] units
    }”
    invoked from within
    “if {[tk windowingsystem] eq “classic” || [tk windowingsystem] eq “aqua”} {
    bind Listbox {
    %W yview scroll [expr {- (%D)}] units
    }
    bind Li…”
    [bds@bds ~]$
    …………………

  8. Hello Brahm,

    xgraph installation requires some additional dependencies, when you install ns2 (from allin one package) just take a look when it start installing xgraph, in the end of xgraph installation it will show an error message stating you can install xgraph later on etc. just note it down and then try to install those dependecies, or else try to install xgrapgh seperately.

    I will try to solve it, as soon as I will be free, meanwhile please make know about the progress.

    Thanks and Regards,
    WirelessCafe Team !

  9. Hi,
    I am installing network simulator on my machine following the instruction. But, unfortunately i am get error messages.
    Can you please suggest what needs to be done.
    Priyanka

    [manish@actd43 netwrk simulator]$ cd ns-allinone-2.34
    [manish@actd43 ns-allinone-2.34]$ ./install
    ============================================================
    * Testing for Darwin (OS X) environment
    ============================================================
    ============================================================
    * Testing for Cygwin environment
    ============================================================
    Cygwin not detected, proceeding with regular install.
    ============================================================
    * Testing for FreeBSD environment
    ============================================================
    FreeBSD not detected
    ============================================================
    * Build XGraph-12.1
    ============================================================
    loading cache ./config.cache
    checking for a BSD compatible install… (cached) /usr/bin/install -c
    checking whether build environment is sane… yes
    checking whether make sets ${MAKE}… (cached) yes
    checking for working aclocal… found
    checking for working autoconf… found
    checking for working automake… found
    checking for working autoheader… found
    checking for working makeinfo… found
    checking if malloc debugging is wanted… no
    checking for gcc… (cached) gcc
    checking whether the C compiler (gcc ) works… yes
    checking whether the C compiler (gcc ) is a cross-compiler… no
    checking whether we are using GNU C… (cached) yes
    checking whether gcc accepts -g… (cached) yes
    checking how to run the C preprocessor… (cached) gcc -E
    checking for X… (cached) libraries /usr/X11R6/lib, headers /usr/X11R6/include
    checking for dnet_ntoa in -ldnet… (cached) no
    checking for dnet_ntoa in -ldnet_stub… (cached) no
    checking for gethostbyname… (cached) yes
    checking for connect… (cached) yes
    checking for remove… (cached) yes
    checking for shmat… (cached) yes
    checking for IceConnectionNumber in -lICE… (cached) yes
    checking for float.h… (cached) yes
    checking for limits.h… (cached) yes
    checking for stdlib.h… (cached) yes
    checking for string.h… (cached) yes
    checking for strings.h… (cached) yes
    checking for unistd.h… (cached) yes
    checking for strcasecmp… (cached) yes
    creating ./config.status
    creating Makefile
    creating autoconf.h
    autoconf.h is unchanged
    xgraph has been installed successfully.
    ============================================================
    * Build CWeb
    ============================================================
    Making cweb
    gcc -g -c -o ctangle.o ctangle.c
    ctangle.w:75: warning: conflicting types for built-in function ‘strlen’
    gcc -g -DCWEBINPUTS=\”/usr/local/lib/cweb\” -c common.c
    common.w:1409: warning: conflicting types for built-in function ‘strlen’
    gcc -g -o ctangle ctangle.o common.o
    gcc -g -c -o cweave.o cweave.c
    cweave.w:79: warning: conflicting types for built-in function ‘strlen’
    gcc -g -o cweave cweave.o common.o
    ln: when making multiple links, last argument must be a directory
    ln: when making multiple links, last argument must be a directory
    ============================================================
    * Build Stanford GraphBase
    ============================================================
    Making sgb
    cc -g -I/usr/local/sgb/include test_io.c gb_io.o -o test_io
    cc -g -I/usr/local/sgb/include test_graph.c gb_graph.o -o test_graph
    cc -g -I/usr/local/sgb/include test_flip.c gb_flip.o -o test_flip
    ./test_io
    OK, the gb_io routines seem to work!
    ./test_graph
    …………………………………………………………………….. ………………..Hey, I allocated 10000000 bytes successfully. Terrific…
    OK, the gb_graph routines seem to work!
    ./test_flip
    OK, the gb_flip routines seem to work!
    make gb_sort.o
    make[1]: Entering directory `/home/manish/netwrk simulator/ns-allinone-2.34/sgb’
    make[1]: `gb_sort.o’ is up to date.
    make[1]: Leaving directory `/home/manish/netwrk simulator/ns-allinone-2.34/sgb’
    make lib
    make[1]: Entering directory `/home/manish/netwrk simulator/ns-allinone-2.34/sgb’
    make[1]: Nothing to be done for `lib’.
    make[1]: Leaving directory `/home/manish/netwrk simulator/ns-allinone-2.34/sgb’
    make test_sample
    make[1]: Entering directory `/home/manish/netwrk simulator/ns-allinone-2.34/sgb’
    cc -g -I/usr/local/sgb/include -L. -L/usr/local/lib test_sample.c -lgb -lgb – o test_sample
    make[1]: Leaving directory `/home/manish/netwrk simulator/ns-allinone-2.34/sgb’
    ./test_sample > sample.out
    diff test.gb test.correct
    diff sample.out sample.correct
    rm -f test.gb sample.out test_io test_io.exe test_graph test_graph.exe test_flip test_flip.exe test_sample test_sample.exe
    echo “Congratulations — the tests have all been passed.”
    Congratulations — the tests have all been passed.
    touch certified
    ============================================================
    * Build GT-ITM
    ============================================================
    gcc -I../include -L../lib -DFBSD -o ../bin/itm itm.o geog.o ts.o dfs.o -lm -lg b
    gcc -I../include -L../lib -DFBSD -o ../bin/sgb2alt sgb2alt.o -lm -lgb
    gcc -I../include -L../lib -DFBSD -o ../bin/edriver edriver.o eval.o -lm -lgb
    gt-itm has been installed successfully.
    gcc -I../include -L../lib -o ../bin/sgb2comns sgb2comns.o -lm -lgb
    gcc -I../include -L../lib -o ../bin/sgb2hierns sgb2hierns.o -lm -lgb
    gcc -I../include -L../lib -o ../bin/sgb2ns sgb2ns.o -lm -lgb
    sgb2ns has been installed successfully.
    ============================================================
    * Build zlib
    ============================================================
    Checking for gcc…
    Building static library libz.a version 1.2.3 with gcc.
    Checking for unistd.h… Yes.
    Checking whether to use vs[n]printf() or s[n]printf()… using vs[n]printf()
    Checking for vsnprintf() in stdio.h… Yes.
    Checking for return value of vsnprintf()… Yes.
    Checking for errno.h… Yes.
    Checking for mmap support… Yes.
    gcc -O3 -DUSE_MMAP -c -o example.o example.c
    gcc -O3 -DUSE_MMAP -c -o adler32.o adler32.c
    gcc -O3 -DUSE_MMAP -c -o compress.o compress.c
    gcc -O3 -DUSE_MMAP -c -o crc32.o crc32.c
    gcc -O3 -DUSE_MMAP -c -o gzio.o gzio.c
    gcc -O3 -DUSE_MMAP -c -o uncompr.o uncompr.c
    gcc -O3 -DUSE_MMAP -c -o deflate.o deflate.c
    gcc -O3 -DUSE_MMAP -c -o trees.o trees.c
    gcc -O3 -DUSE_MMAP -c -o zutil.o zutil.c
    gcc -O3 -DUSE_MMAP -c -o inflate.o inflate.c
    gcc -O3 -DUSE_MMAP -c -o infback.o infback.c
    gcc -O3 -DUSE_MMAP -c -o inftrees.o inftrees.c
    gcc -O3 -DUSE_MMAP -c -o inffast.o inffast.c
    ar rc libz.a adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
    gcc -O3 -DUSE_MMAP -o example example.o -L. libz.a
    gcc -O3 -DUSE_MMAP -c -o minigzip.o minigzip.c
    gcc -O3 -DUSE_MMAP -o minigzip minigzip.o -L. libz.a
    Zlib has been installed successfully.
    ============================================================
    * Build tcl8.4.18
    ============================================================
    make: *** No rule to make target `/Makefile.in’, needed by `Makefile’. Stop.
    configure: WARNING: you should use –build, –host, –target
    configure: WARNING: invalid host type: simulator/ns-allinone-2.34
    ./configure: line 1328: cd: /home/manish/netwrk: No such file or directory
    checking whether to use symlinks for manpages… no
    checking whether to compress the manpages… no
    checking whether to add a package name suffix for the manpages… no
    checking for simulator/ns-allinone-2.34-gcc… no
    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 ANSI C… none needed
    checking how to run the C preprocessor… gcc -E
    checking for egrep… 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 dirent.h… yes
    checking errno.h usability… yes
    checking errno.h presence… yes
    checking for errno.h… yes
    checking float.h usability… yes
    checking float.h presence… yes
    checking for float.h… yes
    checking values.h usability… yes
    checking values.h presence… yes
    checking for values.h… yes
    checking limits.h usability… yes
    checking limits.h presence… yes
    checking for limits.h… yes
    checking for stdlib.h… (cached) yes
    checking for string.h… (cached) yes
    checking sys/wait.h usability… yes
    checking sys/wait.h presence… yes
    checking for sys/wait.h… yes
    checking dlfcn.h usability… yes
    checking dlfcn.h presence… yes
    checking for dlfcn.h… yes
    checking for unistd.h… (cached) yes
    checking sys/param.h usability… yes
    checking sys/param.h presence… yes
    checking for sys/param.h… yes
    checking if the compiler understands -pipe… yes
    checking for building with threads… no (default)
    checking for sin… no
    checking for main in -lieee… yes
    checking for main in -linet… no
    checking net/errno.h usability… no
    checking net/errno.h presence… no
    checking for net/errno.h… no
    checking for connect… yes
    checking for gethostbyname… yes
    checking how to build libraries… static
    checking for simulator/ns-allinone-2.34-ranlib… no
    checking for ranlib… ranlib
    checking if 64bit support is requested… no
    checking if 64bit Sparc VIS support is requested… no
    checking system version… Linux-2.6.9-42.ELsmp
    checking for dlopen in -ldl… yes
    checking for ar… ar
    checking for build with symbols… no
    checking for required early compiler flags… _LARGEFILE64_SOURCE
    checking for 64-bit integer type… long long
    checking for struct dirent64… no
    checking for struct stat64… yes
    checking for open64… yes
    checking for lseek64… yes
    checking for off64_t… yes
    checking whether byte ordering is bigendian… no
    checking for getcwd… yes
    checking for opendir… yes
    checking for strstr… yes
    checking for strtol… yes
    checking for strtoll… yes
    checking for strtoull… yes
    checking for tmpnam… yes
    checking for waitpid… yes
    checking for strerror… yes
    checking for getwd… yes
    checking for wait3… yes
    checking for uname… yes
    checking for realpath… yes
    checking sys/modem.h usability… no
    checking sys/modem.h presence… no
    checking for sys/modem.h… no
    checking termios vs. termio vs. sgtty… termios
    checking for fd_set in sys/types… yes
    checking whether struct tm is in sys/time.h or time.h… time.h
    checking sys/time.h usability… yes
    checking sys/time.h presence… yes
    checking for sys/time.h… yes
    checking whether time.h and sys/time.h may both be included… yes
    checking for struct tm.tm_zone… yes
    checking for gmtime_r… yes
    checking for localtime_r… yes
    checking tm_tzadj in struct tm… no
    checking tm_gmtoff in struct tm… yes
    checking long timezone variable… yes
    checking for struct stat.st_blksize… yes
    checking for fstatfs… yes
    checking for working memcmp… yes
    checking for memmove… yes
    checking proper strstr implementation… ok
    checking for strtoul… yes
    checking proper strtoul implementation… ok
    checking for strtod… yes
    checking proper strtod implementation… ok
    checking for strtod… (cached) yes
    checking for Solaris2.4/Tru64 strtod bugs… ok
    checking for mode_t… yes
    checking for pid_t… yes
    checking for size_t… yes
    checking for uid_t in sys/types.h… yes
    checking for socklen_t… yes
    checking for opendir… (cached) yes
    checking union wait… yes
    checking for strncasecmp… yes
    checking for BSDgettimeofday… no
    checking for gettimeofday… yes
    checking for gettimeofday declaration… present
    checking whether char is unsigned… no
    checking signed char declarations… yes
    checking for a putenv() that copies the buffer… no
    checking langinfo.h usability… yes
    checking langinfo.h presence… yes
    checking for langinfo.h… yes
    checking whether to use nl_langinfo… yes
    checking for fts… yes
    checking sys/ioctl.h usability… yes
    checking sys/ioctl.h presence… yes
    checking for sys/ioctl.h… yes
    checking sys/filio.h usability… no
    checking sys/filio.h presence… no
    checking for sys/filio.h… no
    checking system version… (cached) Linux-2.6.9-42.ELsmp
    checking FIONBIO vs. O_NONBLOCK for nonblocking I/O… O_NONBLOCK
    checking whether to enable DTrace support… no
    configure: creating ./config.status
    ./config.status: line 305: simulator/ns-allinone-2.34/tcl8.4.18/unix: No such file or directory
    config.status: creating Makefile
    config.status: creating dltest/Makefile
    config.status: creating tclConfig.sh
    make: *** No rule to make target `/Makefile.in’, needed by `Makefile’. Stop.
    tcl8.4.18 make failed! Exiting …
    For problems with Tcl/Tk see http://www.scriptics.com
    [manish@actd43 ns-allinone-2.34]$

  10. Dear Priyanka,

    Sorry for a late reply, your comment landed into the spams. you are missing some dependencies, go through this post on error with ns2 installation ns2 revisited

    Also go through the comment section, you will get your solution there and in the end, just make us know about your solution.

    All the best,
    Ashwini for WirelessCafe Team !

  11. hi
    im going to do my project on ns2.I have installed ns2 in linux-redhat environment.
    But iam facing some problems while trying to execute sample codings.while giving
    ns example.tcl
    bash:ns:command not found
    ,line appears.Y its happening so.what is bash,how can i correct it.. can any one plz help me..

    thanks in anticipation.
    reshma

  12. Dear Reshma,

    Go through the post “how to install ns2″ in the end , there is given how to set the environment variables, set the variables and then restart the machine, you will get the ns prompt after typing ns.

    Thanks and Regards,
    Ashwini For WirelessCafe !

  13. Pingback: 2010 in review « Wirelesscafe

  14. some problems while trying to execute sample codings
    ns example.tcl
    bash:ns:command not found
    ,line appears.Y its happening.
    i already set the environment variables.

  15. Rajan,

    Have you restarted your machine ? or else refer NS2 installation on Fedora OR Error with ns2 revisited for setting environment variables.

    All the best,
    Ashwini for WirelessCafe !!

  16. hi,
    in my project i am using ns2 simulator,but i don’t know how to install please send me screen shorts with clearly.

  17. Dear Balaji,

    go through the post on how to install ns2, it is having step by step procedure (without screen shots :) will add when I will upgrade my OS)

    All the best,
    Ashwini for WirelessCafe !!

  18. hi guys I am new in NS2 environment and I am not familiar so is there any one give me full steps to install on my computer, and now I am using window 7 so which process I have to follow.

    thank you all

  19. Dear Haja,

    step 1. install some linux distro ( I prefer Fedora )
    step 2. read the other blog post “How to install ns2″ and follow the steps
    step 3. enjoy ns

    All the best,
    Ashwini for WirelessCafe !!

  20. hello ashiwni sir i have done ns 2.31 installtion in my dell laptop , i have also got ns install confirmation % sign, but i am unable to run tcl file and its showing”ns command not found” instruction when i am executing file,please help me

  21. Dear Satish,

    May be you forget to set the environment variables :)

    All the best,
    Ashwini for WirelessCafe !!

  22. Hello sir,i am installing ns2 2.27 on Redhat4,while installing the following problem occur,please solve this problem.

    make: *** [Tcl.o] Error 1
    tclcl-1.15 make failed! Exiting …

  23. hello sir,
    I want to modify routing table used by a node so that it can contain node’s ancestor list.
    Hoe to modify the routing table? Plz guide me.

  24. Dear Prajakta,

    refer to the archives of ns2 google groups.

    All the best,
    Ashwini for WirelessCafe !!

  25. Dear Amrutasagar,

    Please paste more lines from the error message.

    All the best,
    Ashwini for WirelesCafe !!

  26. hi sir, its honey here…
    i m using ns2 for my master’s project i have installed ns2 successfully everything working fine. but after running tcl files i m unable to analyze them . i dont knw how to read or analyze. kidnly help for this & also for trace files how can i create them
    regards

  27. hi sir! i m doing my masters thesis on ns2 but i m a newbee here on ns2. i have installed it on redhat and successfully running. but the problm is i dont know how to analyze them n trace the results thorugh trace files.
    kindly guide me.

    Regards

  28. Dear Honey,

    check this document, http://www-sop.inria.fr/maestro/personnel/Eitan.Altman/COURS-NS/n3.pdf

    All the best,
    Ashwini for WirelessCafe !!

  29. hi friends…

    we are doing our project on ns2.. we want to know the calculation of throughput in both wired and wireless pls help..

    Thanks in advance…

  30. Dear Mca,

    There is pdf tutorial on ns2 site, it contains the code for measuring throughput.

    All the best,
    Ashwini for WirelessCafe !!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s