Cygwin + NS2 + Win XP 安装方法 网下 唯一 有效版
作者:木头。转载请说明出处。安装包可在我发布的下载里下到。
时间:2013年1月9日。
测试操作系统坏境:WINDOWSXP SP3。
鉴于网上流传的各种说不清,BUG重重的安装方法,以及已经“死无对证”的很多成功方法。我经过若干天的总结终于总结出了XP下详细的Cygwin+NS2+XP安装步骤。尤其是包的安装,并不是一次性的,为了防止吃错,最好先安装基础包。
【Note】安装时请把杀毒软件关掉(金山,瑞星,卡巴等等)
—————————————————华丽的分割线————————————————
一、Cygwin安装:
第1步: 找到安装文件夹Cygwin下的注双击安装程序。
第2步: 遇到弹出窗口点确定,别虚。下一步;
第3步: 选择本地安装(第三个)。选择后下一步。
第4步: 保持默认Root :C:\cygwin;Default Text File Type保持默认(Unix)
第5步: Browser到安装文件夹下的SourcePackages. 下一步
第6步: 继续下一步
第7步: 基础包安装完成
第8步: 重新运行,其他的都一样,直到弹出
第9步:点击右上角的 【View】 按钮,切换到Full模式;把左下角的Hide obsoletepackages取消勾选;使用左上角的Search,依次选择以下安装包,(点击Skip,使其显示版本数字,如图)已经安装过的(显示为数字)保持就行。
安装包列表为:
gcc
gcc-g++
make
patch
perl
tar
X-startup-scripts
tcltk
w32api
diffutils
libX11-devel
libXext-devel
xorg-x11-bin-dlls
libXmu-devel
libXmu6
libxt-devel
XFree86-base
XFree86-bin
XFree86-prog
XFree86-lib
XFree86-etc
第10步:下一步,耐心等待完成。半个小时上下。
第11步:完成。
二、NS2安装
第1步:把NS2文件夹下的ns-allinone-2.28.tar.gz复制到C:\cygwin\home\Administrator下;【Note】如果你的计算机自己命名了,那么这个Administrator是自己的名字,下文同理。
第2步:双击桌面上的Cygwin终端,打开后输入:(解压操作)
tar xvfz ns-allinone-2.28.tar.gz
第3步:耐心等待解压完毕后,在当前目录下生成一个文件夹:ns-allinone-2.28
(a) 解压完成后,回到Win中进行操作;进入ns-allinone-2.28/nam-1.11下,将文件agent.h中的第73行的“null”改为“0”;
(b) 然后分别在WinXp下打开如下5个目录中的文件:
ns-allinone-2.28/tcl8.4.5/unix/configure
ns-allinone-2.28/tcl8.4.5/unix/tcl.m4
ns-allinone-2.28/tk8.4.5/unix/configure
ns-allinone-2.28/tk8.4.5/unix/tcl.m4
ns-allinone-2.28/otcl-1.9/configure;
将上述文件中的 .relid’ 改成 .relid ,请使用UE编辑器,Notepad++之一;
第4步:输入:cd ns-allinone-2.28 回车
第5步:输入 ./install 耐心等待完成吧!!
第6步:如果看到以下信息就说明你成为Cygwin+NS2安装达人了!
Nam has been installed successfully.
Ns-allinone package has been installed successfully.
Here are the installation places:
tcl8.4.11: /home/pcraven/ns-allinone-2.29/{bin,include,lib}
tk8.4.11: /home/pcraven/ns-allinone-2.29/{bin,include,lib}
otcl: /home/pcraven/ns-allinone-2.29/otcl-1.11
tclcl: /home/pcraven/ns-allinone-2.29/tclcl-1.17
ns: /home/pcraven/ns-allinone-2.29/ns-2.29/ns
nam: /home/pcraven/ns-allinone-2.29/nam-1.11/nam
xgraph: /home/pcraven/ns-allinone-2.29/xgraph-12.1
gt-itm: /home/pcraven/ns-allinone-2.29/itm, edriver, sgb2alt, sgb2ns, sgb2comns, sgb2hierns
----------------------------------------------
Please put /home/myusername/ns-allinone-2.29/bin:/home/myusername/ns-allinone-2.29/tcl8.4.11/unix:/home/myusername/ns-allinone-2.29/tk8.4.11/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
IMPORTANT NOTICES:
(1) You MUST put /home/myusername/ns-allinone-2.29/otcl-1.11, /home/myusername/ns-allinone-2.29/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 <paths>
If you are using sh, you can set it like:
export LD_LIBRARY_PATH=<paths>
(2) You MUST put /home/myusername/ns-allinone-2.29/tcl8.4.11/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.11
and tk8.4.11. They are now installed under /home/myusername/ns-allinone-2.29/{bin,include,lib}
After these steps, you can now run the ns validation suite with
cd ns-2.29; ./validate
For trouble shooting, please first read ns problems page
http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive
for related posts.
第7步:安装成功后别高兴的太早,还要做以下修改:
(1) 把NS2文件夹下的nam.exe拷贝到该目录下(如果已经有了,请覆盖):C:\cygwin\home\Administrator\ns-allinone-2.28\nam-1.11
(2) 打开C:\cygwin\home\Administrator下的.bashrc文件,把以下代码追加到文件里:
export NS_HOME=`pwd`/ns-allinone-2.28
export PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOME/bin:$PATH
export LD_LIBRARY_PATH=$NS_HOME/tcl8.4.5/unix:$NS_HOME/tk8.4.5/unix:$NS_HOME/otcl-1.9:$NS_HOME/lib:$LD_LIBRARY_PATH
export TCL_LIBRARY=$NS_HOME/tcl8.4.5/library
第8步:回到Cygwin窗口,输入startxwin.bat看看吧!如果成功就OK了。
下面对NS2的操作我就不说咯,That’s yourbusiness!
参考文献:
[1] Cygwin 官网:http://www.cygwin.com/
[2] ns2.27安装: http://www.isi.edu/nsnam/ns/ns-cygwin-old.html
[3] ns在Unix下的安装:http://nsnam.isi.edu/nsnam/index.php/Downloading_and_installing_ns-2
[4] ns2 under windows:
http://nsnam.isi.edu/nsnam/index.php/Running_Ns_and_Nam_Under_Windows_9x/2000/XP_Using_Cygwin