LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to install and run more than one version of ns2 at the same machine (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-install-and-run-more-than-one-version-of-ns2-at-the-same-machine-4175503576/)

Retta 05-01-2014 08:39 AM

How to install and run more than one version of ns2 at the same machine
 
Hi All,

I want to install NS2.31-patch1 and NS2.31-patch2 both the versions and would like to work on both versions.

I've installed two versions of NS2 in two different directories (locations) on Linux CentOS (i use PuTTY to get access to the uni server which run the CentOS):
1- /home/...../"username"/dir1/ns2/
2- /home/...../"username"/dir2/ns2/

I define tow path.sh for each ns-version, and when i want to work on one of them i use the command source ./pathx.sh to activate the path for the desired version.

My problem is even when i using the second version the simulator use the folders and files of the first version.

I did lot of search in NS2 old posts and google but did not find much satisfactory answer. Kindly help me in this or redirect me to some links which can help me to solve these issues.

If i mistaken then,
1) How shall i install both the versions (i already have NS2.31-patch1 installed and now want to install NS2.31-patch2 as well).
2) After installation, While executing any script, how the simulator will
understand which version to use.

Regards,

knudfl 05-01-2014 09:10 AM

You can have as many ns-allinone-2.xx as you want ( I have 90 ),
installed at the same time.
But do not add any *PATH text to .bashrc : Usually not required.
( Unless it's the "University Computer" : No write access to /usr/.)
* The executable `ns*ī is hard coded to know the location of itīs libraries.
( Which means you cannot move or rename the "ns-allinone-*/{bin/, lib/}" ).

How to setup / use, example :
//dir1/// ns-2.31/ : $ cp ns ns-orig ; # cp ns-orig /usr/local/bin/ .
//dir2/// ns-2.31/ : $ cp ns ns-tfrc ; # cp ns-tfrc /usr/local/bin/ .
//dir3/// ns-2.31/ : $ cp ns ns-crahn ; # cp ns-crahn /usr/local/bin/ .
//dir4/// <any ns2 version> , etc. etc.
Ref. @Retta http://www.linuxquestions.org/questi...or-4175503446/

All simulations will usually work perfect with $ ns-<name> file.tcl ,
like $ ns-crahn test-random-topology.tcl .

In occasions where a bash script uses plain 'ns' :
Copy the appropriate 'ns' to /usr/local/bin/ . Or edit the shell script.

-

Retta 05-01-2014 11:51 AM

Thank you very much knudfl,

unfortunately i do not have privilege (access) to the directory "/usr/local/bin/" cause i work on the university server and i have access only to my account directories starting from username "/home/...../"username"/dir1/ns2/"; Therefore, i have to setup (define) it locally in each ns-ver dir.

May i ask your help.

many thanks

knudfl 05-01-2014 12:26 PM

# 3 .

Suggest :
Use like "$ ./ns*" , i.e. use a copy of ns-<name> in each example folder :
$ ./ns-crahn test-random-topology.tcl

Or copy those different nsīs into /home/retta/bin/{ns-crahn ns-orig},
and use the full path :
$ /home/retta/bin/ns-orig file.tcl
$ /home/retta/bin/ns-crahn test-random-topology.tcl
... Or / and add /home/retta/bin/ to .bashrc .

The PATHīs in the .bashrc can also take care of 'nam' and 'xgraph',
when they are called.

-

Retta 05-02-2014 08:09 AM

Thanks knudfl, you are more than genius.

I used your first suggestion #4, and i finally succeeded in building more than ns-version at the same time.

Many thanks.

Retta 05-16-2014 05:59 AM

Modifying the ns source-code

Please be aware each time you modify the ns source-code,
you have to create a new executable `ns*ī just like post #2
i.e. cd to your ~/../ns-2.XX then
~/../ns-2.XX/: $ cp ns ns-XXX;
finally copy ns-xxx to your script's dir and then execute it.


All times are GMT -5. The time now is 07:25 AM.