ubuntu6.06下装ns2

OOo,TeX,KO,ABI,GIMP,Picasa,ProE,QCAD,Inkscape,Kicad,Eagle
回复
snappy
帖子: 279
注册时间: 2006-03-02 22:34
来自: 广西南宁
送出感谢: 0
接收感谢: 0
联系:

ubuntu6.06下装ns2

#1

帖子 snappy » 2007-03-03 10:29

装了ubuntu6.06以后,连make和gcc都没有,运行

sudo apt-get install build-essential(要联网),就可以装上gcc和make了。



再用

sudo apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev(要联网)

把tcl\tk装上



在网上下载ns-allinone-2.29.3.tar.gz(注意:一定要是最新版2.29.3, 2.29.2都不行,因为ubuntu 是6.06版)

解压,进入解压后的目录,在命令行敲入安装命令

./install

等着安装完毕(要花几十分钟时间到一个小时,视电脑配置)。

安装完后提示的最后的部分如下:(两虚线之间),最好把它复制下来存好。

------------------------

Please put /home/ra/Desktop/ns-allinone-2.29/bin:/home/ra/Desktop/ns- allinone-2.29/tcl8.4.11/unix:/home/ra/Desktop/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/ra/Desktop/ns-allinone-2.29/otcl-1.11, /home/ra/Desktop/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/ra/Desktop/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/ra/Desktop/ns-allinone-2.29 /{bin,include,lib}



After these steps, you can now run the ns validation suite with

cd ns-2.29; ./validate

---------------------------------

这个提示告诉你要写三个环境变量。



用这个命令打开环境变量配置的文件:

sudo gedit ~/.bashrc



在最后加上:

export PATH=$PATH:/home/yangming/ns-allinone-2.29/bin:/home/yangming/ns-allinone-2.29/tcl8.4.11/unix:/home/yangming/ns- allinone-2.29/tk8.4.11/unix



export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/yangming/ns-allinone-2.29/otcl-1.11:/home/yangming/ns-allinone-2.29/lib



export TCL_LIBRARY=$TCL_LIBRARY:/home/yangming/ns-allinone-2.29/tcl8.4.11/library



并保存退出。(强烈注意:格式参考这个(各条路径之间是用冒号:隔开),里面的路径参照上面所保存的两虚线之间的部分,很简单的,英文稍微懂点就知道怎么改了)



接下来检验NS有没有装好:

1.命令行里敲入ns 应该出个%

2.命令行里运行ns example1.tcl 可以看到运行结果。



附example1.tcl:



set ns [new Simulator]



set tracefd [open example1.tr w]

$ns trace-all $tracefd

set namtracefd [open example1.nam w]

$ns namtrace-all $namtracefd



proc finish {} {

global ns tracefd namtracefd

$ns flush-trace



close $tracefd

close $namtracefd



exec nam example1.nam &

exit 0

}



set n0 [$ns node]

set n1 [$ns node]



$ns duplex-link $n0 $n1 1Mb 10ms DropTail



set udp0 [new Agent/UDP]

$ns attach-agent $n0 $udp0



set cbr0 [new Application/Traffic/CBR]

$cbr0 set packetSize_ 500

$cbr0 set interval_ 0.005

$cbr0 attach-agent $udp0



set null0 [new Agent/Null]

$ns attach-agent $n1 $null0



$ns connect $udp0 $null0



$ns at 0.5 "$cbr0 start"

$ns at 4.5 "$cbr0 stop"



$ns at 5.0 "finish"



$ns run
Ubuntu8.04
IBM T40 PM 1.5G
1.5G内存
80G硬盘
14.1XGA
显卡 ATI RADEON 7500 32M
56K/1GB/红外/TV-out/无线802.11b
COMBO
头像
yang_hui1986527
帖子: 888
注册时间: 2006-03-04 23:10
来自: 江西高安
送出感谢: 0
接收感谢: 2 次
联系:

#2

帖子 yang_hui1986527 » 2007-05-27 15:44

支持下
做毕业设计的时候用NS2仿真
呵呵
QQ:273247606
EMAIL:yanghui1986527@gmail.com
回复

回到 “办公、图像、机械电子设计等”