Setting environmental variables when installing ns2 on fedora 15
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Setting environmental variables when installing ns2 on fedora 15
Hi. I'm trying to install ns2.29.3 on fedora15.
Following the steps required, I have installed ns2 successfully.
I installed it in a folder in the following path:
home/naregs/ns2/ns-allinone2.29
I used sudo gedit ~/.bashrc to edit the variables in the /.bashrc file.
I saved the file after changes, and now when I type ns I get %.
so ns2 and nam are working. I have not validate it yet.
BUT the problem is now that I want to login as root, when I type
[narges@localhost ~]$ su
Password:
bash: #: command not found...
bash: #: command not found...
bash: #: command not found...
[root@localhost narges]#
As you can see, I am able to login as root but before that I get the "bash" error. and I dont understand why.
I restarted the system but i get the same problem.
Its the 2nd time I install ns2. I am 100% sure that the path variables are correct. I've paste them here for you to see. I dindt have this error the last time.
I searched the web but havent found a solution yet. What have I done wrong in the /.bashrc file that gave me this error?
before I make changes in there, I couldnt run ns2 unless I go the directory. but at least i didnt have any bash error. now I can run ns2 and nam. and I can login as root. but everytime I get the errors shown above.
Please help me. Thanks in advance.
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
Quote:
Setting environmental variables when installing ns2
Not required. Just install the binary /binaries, that you use :
cd ns-allinone2.29/ns-2.29/ ; su ; make install
cd ../nam-1.11/ ; make install
The binary 'ns' is hard coded to known the location of its libraries.
And 'nam' is usually partly statically compiled :
An OK nam will work on a Linux OS with no tcl and no ns2 installed !
BTW, the first time i entered the path variables in bashrc file and saved them. it gave me
export 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB'not a valid identifier
bash: #: command not found...
bash: #: command not found...
errors, I changed the Makefile.in under /home/narges/ns2/ns-allinone-2.29/ns-2.29
as follows:
CC = gcc34
CPP = g++34
so i dont get export error as before. but i get the one i posted in porst#1.
Not required. Just install the binary /binaries, that you use :
cd ns-allinone2.29/ns-2.29/ ; su ; make install
cd ../nam-1.11/ ; make install
.
you say not required to set the path. but without it I can not run ns2 as root from anywhere. right? I have to go to the directory and type ./ns.
and the installation is done completely successfully. so I think the problem is not in the installation. It has to do with bashrc file which I dont understand.
I agree that nam is a separate application. last time I couldnt run nam1.11 on fedora 15 and had to use nam 1.14. But on this machin on a same fedora 15 os I can use nam 1.11.
when I'm not logged in as a root (as a normal user), and I go to the
[narges@localhost tcl]$ cd /home/narges/ns2/ns-allinone-2.29/ns-2.29/tcl/ex
[narges@localhost ex]$ ./ns wireless.tcl
bash: ./ns: No such file or directory
But If I type
[narges@localhost ex]$ su
Password:
bash: #: command not found...
bash: #: command not found...
bash: #: command not found...
[root@localhost ex]# ns wireless.tcl
i get results.
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
Quote:
[narges@localhost tcl]$ cd /home/narges/ns2/ns-allinone-2.29/ns-2.29/tcl/ex
[narges@localhost ex]$ ./ns wireless.tcl
bash: ./ns: No such file or directory
No, of course not. The period ( . ) in "./ns"
means a file in the current directory.
And there is no 'ns' in ns-2.29/tcl/ex/
No, of course not. The period ( . ) in "./ns"
means a file in the current directory.
And there is no 'ns' in ns-2.29/tcl/ex/
..
Here is the result without "."
[narges@localhost ~]$ cd /home/narges/ns2/ns-allinone-2.29/ns-2.29/tcl/ex
[narges@localhost ex]$ ns wireless.tcl
bash: ns: command not found...
Similar command is: 'nc'
Quote:
Originally Posted by knudfl
No. # 'make install' will copy 'ns' to /usr/local/bin/ .
Thus 'ns' is in a system path, and can executed from any location.
..
So, I used make install under ns-allinone-2.29:
[narges@localhost ex]$ cd /home/narges/ns2/ns-allinone-2.29/
[narges@localhost ns-allinone-2.29]$ make install
make: Nothing to be done for `install'.
cd ns-allinone-2.29/ns-2.29
su
make install && exit
( That's what root is for : Administrative tasks.
E.g. installing files to a location outside /home/<user-name> ).
.
I did as you said above(make install under/ns2.29 and nam-1.11), now wherever I type #ns as a normal user, I get %.
I REMOVED the paths I entered in ./bashrc file, now when I type #su and I enter the password, I am logged in as root with NO bash: #: command not found... error.
The problem now is when I want to run a tcl file under /tcl/ex I get the following error:
[narges@localhost ~]$ cd /home/narges/ns2/ns-allinone-2.29/ns-2.29/tcl/ex
[narges@localhost ex]$ ns simple.tcl
couldn't open "out.tr": permission denied
while executing
"open out.tr w"
invoked from within
"set f [open out.tr w]"
(file "simple.tcl" line 13)
(of course when I type the command as root I get results, but as u said I shouldnt use ns commands as root).
I think working with ns2, everytime you solve a problem you'll face a new one. so annoying.
Thank you so much for helping me.
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
# 11.
Quote:
couldn't open "out.tr": permission denied
That's the reason why root shouldn't be used in /home/narges/.
The permissions will change, so only root has access.
Solution : su ; chown -R narges:narges ns/ns-allinone-2.29/*
chown -R narges:narges ns/ns-allinone-2.29/*/*
chown -R narges:narges ns/ns-allinone-2.29/*/*/*
chown -R narges:narges ns/ns-allinone-2.29/*/*/*/* && exit
Quote:
now when I type #su and I enter the password,
I am logged in as root with NO bash: #: command not found... error.
No, you are not logged in as root, when you open a terminal.
It's just a terminal, that will accept administrative commands.
Don't know, why bash can't be used by root.
May be you added something to /root/.bashrc , when working as root.
Please have a look, and delete alien entries, if any.
Hi again.
Regarding your post #12, I applied and changed the permission on my ns2.
But I have installed another ns2 in a different linux in VmWare earlier and I had used root to install ns2 and NIST mobile wimax module.
So now that I want to change the permission for ns2 folder, although I apply"chown" command the way you mentioned in post#12, It is not effective on this ns2.
ns2 is installed in /home/narges/ns-allinone-2.29
[narges@localhost ~]$ su
[root@localhost narges]# chown -R narges:narges /home/narges/ns-allinone-2.29/*
[root@localhost narges]# chown -R narges:narges /home/narges/ns-allinone-2.29/*/*
[root@localhost narges]# chown -R narges:narges /home/narges/ns-allinone-2.29/*/*/*
[root@localhost narges]# chown -R narges:narges /home/narges/ns-allinone-2.29/*/*/*/*
[root@localhost narges]# exit
exit
[narges@localhost ~]$ ns
bash: ns: command not found...
Similar command is: 'nc'
why is that so? I have installed NIST wimax and mobility on ns2 after solving lots of errors and really dont want to reinstall the ns2 again.
Is there anyway to solve it?
Thank you.
I get nothing when I enter the 2commands.
[narges@localhost ns-allinone-2.29]$ ls -Rl | grep root
[narges@localhost ns-allinone-2.29]$ ls -Rl | grep -B 20 root
nothing seemes to be owned by root.
but how come the permission is not changed on ns2 folder? I dont understand it
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.