Windows + Cygwin + NS2.docx

上传人:b****6 文档编号:5075525 上传时间:2022-12-13 格式:DOCX 页数:30 大小:684.41KB
下载 相关 举报
Windows + Cygwin + NS2.docx_第1页
第1页 / 共30页
Windows + Cygwin + NS2.docx_第2页
第2页 / 共30页
Windows + Cygwin + NS2.docx_第3页
第3页 / 共30页
Windows + Cygwin + NS2.docx_第4页
第4页 / 共30页
Windows + Cygwin + NS2.docx_第5页
第5页 / 共30页
点击查看更多>>
下载资源
资源描述

Windows + Cygwin + NS2.docx

《Windows + Cygwin + NS2.docx》由会员分享,可在线阅读,更多相关《Windows + Cygwin + NS2.docx(30页珍藏版)》请在冰豆网上搜索。

Windows + Cygwin + NS2.docx

Windows+Cygwin+NS2

Windows+Cygwin+NS2

ThisdocumentwillshowyouhowtoinstallNS2onWindowsplatform(windows2000orwindowsXP).TheNS2versionforthisdocumentisns-2.27.Ifyouwanttousens-2.28,itisok.Thestepsaresimilar.

安装准备:

首先解压ns-setup压缩包,注意解压的路径不要有空格

当前windows登陆的用户名不能有空格

运行解压后的安装程序文件夹里的setup.exe

[Cygwin]

1.Downloadthesoftwarefromhere.Decompresstherarfile.Youwillseeasetup.exe.Clickthisfile.Itwillbelikethefollowingfigure.

2.BecausethelanguageofoperatingsystemisTraditionalChinese.ThetextofbuttonisshowninChinese.Butyoudon’tneedtoworryaboutthis.IthinkitisshowninEnglishinyourcomputer.Justclick“Next”.

3.Thenchoose“InstallfromLocalDirectory”

4.Click“Next”.

(Justkeepthesettingsastheyare.)

注意:

这里的RootDirectory必须填“C:

\cygwin”(不包括“”号)

5.Click“Next”

6.Click“Browse”tochoosewherethesoftwareis.(Pleasechoose“ftp%3a%2f%2fftp.nctu.edu.tw%2fWindows%2fcygwin”)

(这个文件夹在解压后的安装程序文件夹里有)

7.Click“OK”.

8.Click“Next”andyouwillseethefigureshownasfollows.Inthiswindow,thecygwinsetupprogramletyouchoosewhatsoftwareyouwanttoinstall.

9.Click“View”firsttomaketheword“Category“changeto“Full”.

在上面的对话框的Package栏里找到下面用红色字体标记出来的包,在包对应的New栏位置单击鼠标,保证选择的不是Skip,而是类似于4.3.0-1这样的版本号

10.XFree86-base,XFree86-bin,XFree86-prog,XFree86-lib,XFree86-etc,make,patch,perl,gcc,gcc-g++,gawk,gnuplot,tarandgzipmustbechosen.Forexample,ifIwanttoinstallXFree-86base(upperfigure),clickthe“Skip”of“New”column.The“Skip”willbechangedto“4.3.0-1”(lowerfigure).

11.Click“Next”.

(Pleasebepatient.Itmaytakealongtimetofinishtheinstallation.)

等待……

12.Whensetupisdone,itwillbeshownasfollowingfigure.Click“Finish”.

13.Click“OK”tofinishthecygwinsetupprogram.

[NS2setup]

1.Clicktheicononthedesktop.

2.Forthefirsttimeexecution,itwillgeneratesomeenvironmentparametersettingfiles.Inthisexample,smallkoismyloginnametowindowssystem.Therefore,thecygwinwillcreateafoldernamed“smallko”underhomedirectory.(Theactualpathforsmallkofolderis:

c:

\cygwin\home\smallko)Itshouldbenoticedthattheloginnamecannothaveanyspaceinyourname.Forexample,“AB”maycauseerrorswhenyouinstallNS2.(smallko-hpdsismycomputername)

3.Pleasecopyns-allinone-2.27.tar.gz(这个文件在解压后的安装程序文件夹里)intoyourdirector.Inthisexample,Icopythisfiletoc:

\cygwin\home\smallko(smallko为当前Windows的登陆用户名,不同的电脑不同).Thendecompressthecompressedfile.Usethecommand“tarxvfzns-allinone-2.27.tar.gz”.

4.Whenthedecompressionisfinished,itwillbeshownasfollows.

5.Begintoinstallns-allinone-2.27.Changepathtothens-allinone-2.27bytyping“cdns-allinone-2.27”.Thentype“./install”.

6.Pleasetype“y”tocontinue.

7.Whenitisfinished,itisshownasfollows.

8.ButbeforeyoustartrunningNS2simulation,youshouldsetthepathfirst.Ihavepreparedonefileforit.Justcopythe“.bashrc”toreplacetheoneunderyourhomedirectory.(Inthisexample,Icopy.bashrctoc:

\cygwin\home\smallko)

具体步骤:

在解压后的安装程序文件夹目录下找到.bashrc文件,用写字板打开,找到:

exportNS_HOME=/home/Administrator/ns-allinone-2.27

这一行,将中间的Administrator改为当前windows登陆的用户名,比如说当前登陆的用户名为AimaT,就改为

exportNS_HOME=/home/AimaT/ns-allinone-2.27

然后保存关闭,将修改过的.bashrc文件复制到:

C:

\cygwin\home\Administrator\

(Administrator同样为当前的windows的登陆用户名)下代替已有的.bashrc文件

[Testing]

1.Toinitialgraphicalmode.(type“startxwin.bat”)

2.Runtheexampletclscript.(Changeto~/ns-allinone-2.27/ns-2.27/ns-tutorial/examples.Thenrunthecommand

“nsexample2.tcl”)

3.Ifyoucanseethefollowingfigures,congratulations.Youhavesuccessfullyinstallcygwin+ns-2.27underwindowsplatform.

Lastmodified:

2005/06/24

Author:

Chih-Heng,Ke

Website:

http:

//140.116.72.80/~smallko

Email:

smallko@ee.ncku.edu.tw

Phdcandidate,EE

Department,NCKU,Taiwan

 

NS2安装(WindowsXP+Cygwin+NS-2.27)

声明:

本文为转载

在win9x/2000/xp环境下安裝ns2网络模拟软件

(这是柯老师文章的简体化版本,原出处:

http:

//140.116.72.80/~smallko/ns2/setup.htm)

参考了官方英文版,网址为:

(a)   安裝cygwin

网站 ,点击InstallorUpdatenow(usingsetup.exe)。

 运行setup.exe。

按下一步。

选择InstallfromInternet,并按下一步。

在RootDirectory中,可以选择安裝的目录,不过在这里建议大家使用默认路徑c:

\cygwin。

 其它另外两个选项也使用默认值即可。

按下一步。

在LocalPackageDirectory中,是让使用者设定cygwin所需要档案的目录。

 使用者可以自行更改路径或者使用与安裝程序setup相同的路径(默认值)。

按下一步。

选择网络连接的方式。

第一种是直接连接,第二种是使用IE5设定,第三种是使用HTTP/FTPProxy的方式。

  若使用者是学校的學生,建议采用第三种方式,可以加快下载的速度。

 以笔者在成功大學下载程式,设定如下。

按下一步。

选择下载的地点(镜像站点),在这里我们选择从上海交通大学的FTP站下载。

按下一步。

选择要安裝的软件套件。

在这里可以先点选View,使得旁边的Category变成Full,这样就可以对于子选项做选择。

要选择的有XFree86-base、XFree86-bin、XFree86-prog、XFree86-lib、XFree86-etc、make、patch、perl、gcc、gcc-g++、gawk、gnuplot、tar和gzip。

以下图为例,点选XFree86-base,可以使得状态从new改变成4.3.0-11。

按下一步。

开始下载並安裝。

完成后,会询问使用者是否想要在桌面和开始菜单中生成图标。

点击完成以结束程序的安装。

若是还需安裝其它的套件,可以重新执行行setup安裝即可。

(额外添加即可,不必全部重装)

(b)  安裝ns2

双击桌面上的cygwin图标。

第一次执行的時候,会根据目前电脑用户和电脑名称等信息,在cygwin的home的目录下产生一個用户资料夹,并放入环境变量设定的相关文件(.bashrc、.bashrc_profile和.inputrc)。

以笔者为例,笔者在windows2000操作系统下的用户名称为smallko,而电脑的名称为ibm240,则cygwin为smallko在home的目录下建立一个主目录(/home/smallko),其对应于C盘的路径为c:

\cygwin\home\smallko;  而输入命令提示符则为smallko@im240~$。

接下來到http:

//www.isi.edu/nsnam/dist/ns-allinone-2.27.tar.gz,下在ns2的安装文件,并存放到自己的主目录下。

所下载的Allinonepackage包括以下组件:

∙        TCLrelease8.4.5(requiredcomponent)

∙        TKrelease8.4.5(requiredcomponent)

∙        Otclrelease1.8(requiredcomponent)

∙        TclCLrelease1.15(requiredcomponent)

∙        Nsrelease2.27(requiredcomponent)

∙        Namrelease1.10(optionalcomponent)

∙        Xgraphversion12.1(optionalcomponent)

∙        CWeb(optionalcomponent)

∙        SGB(optionalcomponent,buildssgblibforallUNIXtypeplatforms)

∙        Gt-itm(optionalcomponent)

∙        Zlibversion1.1.4(optional,butrequiredwhenNamisused)

使用tarxvfzns-allinone-2.27.tar.gz解压缩该压缩文件。

进入ns-allinone-2.27目录,并开始安裝ns2,./install命令.

在安装的中,由于我們沒有安裝diff,所以安裝程式会问用户要不要继续,选择y以继续安裝。

在安裝的过程中,需要花一些时间,所以请用户耐心等待安裝完成。

完成图。

完成ns2的并以后,需要设定环境变量。

请编辑主目录下的.bashrc,把ns2相关的路径加入PATH中。

(.bashrc)

exportNS_HOME=`pwd`/ns-allinone-2.27

exportPATH=$NS_HOME/tcl8.4.5/unix:

$NS_HOME/tk8.4.5/unix:

$NS_HOME/bin:

$PATH

exportLD_LIBRARY_PATH=$NS_HOME/tcl8.4.5/unix:

$NS_HOME/tk8.4.5/unix:

$NS_HOME/otcl-1.8:

$NS_HOME/lib:

$LD_LIBRARY_PATH

exportTCL_LIBRARY=$NS_HOME/tcl8.4.5/library

若是用户想要验证ns2安裝是否成功,可以使用cdns-allinone-2.27/ns-2.27;./validate

不过会占用比较长的时间,需要耐心等待。

在这一小节结束之前,笔者以一个范例来检验ns和nam。

輸入命令startxwin.bat。

会产生一个新的窗口,在此命令窗口中輸入

cdns-allinone-2.27/ns-2.27/ns-tutorial/examples

nsexample2.tcl

模拟结束后,ns会去执行nam。

按一下nam的执行按钮。

就可以看到模拟过程的动画演示。

若是不能執行,请先参考一下这里。

 

Problems&Solutions

P:

 运行startxwin.bat时提示“NoSuchFileorDirectory”

S:

 可能是没有安装X-Startup-Scripts,重新运行setup.exe,然后选择安装就行了

   也可能是环境变量没有设置好,按上面的设置再检查一遍,注意要把hct改成你相应的名字

   另外,应该运行startxwin.bat,不能只打startxwin

P:

 运行nsexamples2.tcl时提示"nosuchfileordirectory"

S:

 如果是找不到examples2.tcl那就是你打cd/home/hct/ns-allinone-2.28/ns-2.28/ns-tutorial/examples的时候出了错

   如果是找不到ns,那就是环境变量没设置好

P:

 运行nsexamples2.tcl时提示“nam:

 nosuchfileordirectory”

S:

 看看你的/home/hct/ns-allinone-2.28/nam-1.11目录下有没有nam.exe文件,有的话就是你的环境变量设置错了,注意要把nam-1.11这个目录加到PATH中

   如果没有nam.exe,那就是编译nam时出错了。

运行gcc-dumpversion看看你的gcc版本,如果是3.4.x,那就好办了。

找到nam-1.11/agent.h,把它的第73行中的NULL改成0,然后回到nam-1.11目录,运行./configure然后运行make,等运行完毕,再试试nsexample2.tcl就应该没问题了

   如果gcc版本不是3.4.x,那就不知道是什么问题了,不过可以肯定是编译出了错,所以换个nam版本试试吧

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 人文社科 > 设计艺术

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1