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. # LD_LIBRARY_PATH OTCL_LIB=/home/narges/ns2/ns-allinone-2.29/otcl-1.11 NS2_LIB=/home/narges/ns2/ns-allinone-2.29/lib X11_LIB=/usr/X11R6/lib USR_LOCAL_LIB=/usr/local/lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB # TCL_LIBRARY TCL_LIB=/home/narges/ns2/ns-allinone-2.29/tcl8.4.11/library USR_LIB=/usr/lib export TCL_LIBRARY=$TCL_LIB:$USR_LIB # PATH XGRAPH=/home/narges/ns2/ns-allinone-2.29/bin:/home/narges/ns2/ns-allinone-2.29/tcl8.4.11/unix:/home/narges/ns2/ns-allinone-2.29/tk8.4.11/unix NS=/home/narges/ns2/ns-allinone-2.29/ns-2.29/ NAM=/home/narges/ns2/ns-allinone-2.29/nam-1.11/ PATH=$PATH:$XGRAPH:$NS:$NAM 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. |
Quote:
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. |
Thank you knudfl for your fast reply.
Quote:
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. |
# 3.
Not quite clear, why you want to log in as root. ( Never required.) And : It it not recommended to use any ns2 commands as root. May prevent you from using your ns-2.29 as unprivileged user. . |
# 5.
Quote:
Quote:
Thus 'ns' is in a system path, and can executed from any location. . |
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 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. Thats why I have to be root to be able to run. |
Quote:
means a file in the current directory. And there is no 'ns' in ns-2.29/tcl/ex/ .. |
Quote:
[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:
[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'. |
Please see post # 2 :
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> ). . |
Quote:
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. |
# 11.
Quote:
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:
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. |
# 13
This will show the files, that are still owned by root : cd /home/narges/ns-allinone-2.29/ ls -Rl | grep root ( -Rl : upper case R. l is a lower case L ). If you can't see which directory to files belong to, please try ls -Rl | grep -B 20 root .... where 20 is an example : Will show 20 lines above a hit. When you have found the "owned by root files" cd <location>/ and : # chown narges:narges * . |
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 |
I managed to change the permision on ns-allinone-2.29.
but when I type [narges@localhost ~]$ ns bash: ns: command not found... Similar command is: 'nc' Do I have to apply "make install" in ns-2.29 folder again? Does that mean that I have to install mobility and wimax module again? |
# 16
If you installed 'ns' to /usr/local/bin/, it should be there. If you didn't : 1) su 2) cp ns /usr/local/bin/ . |
post #17
I installed ns2 with standard procedure.. (tar , cd /ns-allinone-2.29, ./install) and then installed wimax mobility module. and edited the path in bashrc file. but I allways used root to perform ns2 commands. now that I changed the permission, I can not use ns. [root@localhost narges]# cp ns /usr/local/bin/ cp: cannot stat `ns': No such file or directory My question is, if i go to ns-2.29 and apply make install now, do I have to install wimax module again after make install? or it will still be there? |
# 18
Quote:
The binary 'ns' is hard coded to know the location of its libraries. The wimax functions are compiled into the current 'ns'. If you have done everything the right way. Tests like 'ns example2.tcl' , 'ns example.tcl' will show. . |
I could get result previously by using root, but now that I changed the permission of ns-allinone-2.29 folder, as unprivileged user, I can not run the scripts and instead I get
bash: ns: command not found... Similar command is: 'nc' error. |
All times are GMT -5. The time now is 07:48 PM. |