Ubuntu 11.10下安装NS2.35
2013-02-26 13:19
357 查看
Ubuntu 11.10下安装NS2.35
去年学习了2.34的安装方法,后来换了Ubuntu 11.10后重新安装发现NS升级到2.35,官方手册还是使用11年04月的那份。我个人建议学习英文版的手册,因为版本新,里面有一些新添加的东西。中文汉化的手册版本都比较旧,基本都是08年以前的。当然这个因人而异了,中文版看着容易一些而且做了美工,英文版原汁原味。萝卜白菜,各有所爱。
那么现在就来说说最新2.35的安装方法。我们发现2.34安装时要修复不少小问题,可喜的是2.35里面都得到了修正,所以安装起来要容易得多,下面说说具体的步骤吧。
相关阅读:
Ubuntu 11.04下安装ns-allinone-2.34.tar.gz http://blog.csdn.net/vesper305/article/details/8613254
1.安装必备包,和2.34一样
sudo apt-get installbuild-essential
sudo apt-get install tcl8.4tcl8.4-dev tk8.4 tk8.4-dev
sudo apt-get installlibxmu-dev libxmu-headers
sudo apt-get installxorg-dev g++ xgraph
sudo apt-get install g++-4.4
2.将下载好的tar包放到自己想要放置的位置,然后在Terminal进入ns-allinone-2.35文件夹下直接安装
sudo ./install
3.漫长的等待后会出现类似
Please put/usr/local/ns2/ns-allinone-2.34/bin:/usr/local/ns2/ns-allinone-2.34/tcl8.4.18/unix:/usr/local/ns2/ns-allinone-2.34/tk8.4.18/unix
into yourPATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
IMPORTANTNOTICES:
(1) YouMUST put /usr/local/ns2/ns-allinone-2.34/otcl-1.13,/usr/local/ns2/ns-allinone-2.34/lib,
intoyour LD_LIBRARY_PATH environment variable.
Ifit complains about X libraries, add path to your X libraries
intoLD_LIBRARY_PATH.
Ifyou are using csh, you can set it like:
setenvLD_LIBRARY_PATH <paths>
Ifyou are using sh, you can set it like:
exportLD_LIBRARY_PATH=<paths>
(2) YouMUST put /usr/local/ns2/ns-allinone-2.34/tcl8.4.18/library into yourTCL_LIBRARY environmental
variable.Otherwise ns/nam will complain during startup.
Afterthese steps, you can now run the ns validation suite with
cdns-2.34; ./validate
Fortrouble shooting, please first read ns problems page
http://www.isi.edu/nsnam/ns/ns-problems.html.Also search the ns mailing list archive
forrelated posts.
root@www.linuxidc.com:/usr/local/ns2/ns-allinone-2.34#
表明你安装成功了。这时只需更改几个参数:
先输入gedit ~/.bashrc
之后在文本的最后添加
exportPATH="$PATH:/usr/local/ns2/ns-allinone-2.35/bin:/usr/local/ns2/ns-allinone-2.35/tcl8.5.10/unix:/usr/local/ns2/ns-allinone-2.35/tk8.5.10/unix"
exportLD_LIBRARY_PATH="/usr/local/ns2/ns-allinone-2.35/otcl-1.14:/usr/local/ns2/ns-allinone-2.35/lib"
exportTCL_LIBRARY="$TCL_LIBRARY:usr/local/ns2/ns-allinone-2.35/tcl8.5.10/library"
红字部分是相对路径,请更改为自己安装的路径。
之后在Terminal输入ns,显示%就表示运行成功了。可以编辑一个test.tcl文件,里面输入手册一开始提到的例子:
# The preamble
set ns [new Simulator]
;# initialise the simulation
# Predefine tracing
set f [open out.tr w]
$ns trace-all $f
set nf [open out.nam w]
$ns namtrace-all $nf
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
$ns duplex-link $n0 $n2 5Mb2ms DropTail
$ns duplex-link $n1 $n2 5Mb2ms DropTail
$ns duplex-link $n2 $n31.5Mb 10ms DropTail
# Some agents.
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
set cbr0 [newApplication/Traffic/CBR]
$cbr0 attach-agent $udp0
$udp0 set class_ 0
;# A UDP agent
;# on node $n0
;# A CBR traffic generatoragent
;# attached to the UDP agent
;# actually, the default,but. . .
;# Its sink
;# on node $n3
set null0 [new Agent/Null]
$ns attach-agent $n3 $null0
$ns connect $udp0 $null0
$ns at 1.0 "$cbr0start"
puts [$cbr0 set packetSize_]
puts [$cbr0 set interval_]
# A FTP over TCP/Tahoe from$n1 to $n3, flowid 2
set tcp [new Agent/TCP]
$tcp set class_ 1
$ns attach-agent $n1 $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $n3 $sink
;# TCP does not generate itsown traffic
set ftp [newApplication/FTP]
$ftp attach-agent $tcp
$ns at 1.2 "$ftpstart"
$ns connect $tcp $sink
$ns at 1.35 "$nsdetach-agent $n0 $tcp ; $ns detach-agent $n3 $sink"
# The simulation runs for3s.
# The simulation comes to anend when the scheduler invokes the finish{} procedure below.
# This procedure closes alltrace files, and invokes nam visualization on one of the trace files.
$ns at 3.0"finish"
proc finish {} {
global ns f nf
$ns flush-trace
close $f
close $nf
puts "runningnam..."
exec nam out.nam &
exit 0
}
# Finally, start thesimulation.
$ns run
保存之后,Terminal进入文件所在文件夹,运行ns test.tcl,如果成功会打开nam显示模拟情况。
最后,补充一个有用的软件gnuplot,画图利器。
sudo apt-get install gnuplot
源文档 <http://www.linuxidc.com/Linux/2012-03/55990.htm>
[日期:2012-03-06] | 来源:Linux社区 作者: alex43211 | [字体:大 中 小] |
去年学习了2.34的安装方法,后来换了Ubuntu 11.10后重新安装发现NS升级到2.35,官方手册还是使用11年04月的那份。我个人建议学习英文版的手册,因为版本新,里面有一些新添加的东西。中文汉化的手册版本都比较旧,基本都是08年以前的。当然这个因人而异了,中文版看着容易一些而且做了美工,英文版原汁原味。萝卜白菜,各有所爱。
那么现在就来说说最新2.35的安装方法。我们发现2.34安装时要修复不少小问题,可喜的是2.35里面都得到了修正,所以安装起来要容易得多,下面说说具体的步骤吧。
相关阅读:
Ubuntu 11.04下安装ns-allinone-2.34.tar.gz http://blog.csdn.net/vesper305/article/details/8613254
1.安装必备包,和2.34一样
sudo apt-get installbuild-essential
sudo apt-get install tcl8.4tcl8.4-dev tk8.4 tk8.4-dev
sudo apt-get installlibxmu-dev libxmu-headers
sudo apt-get installxorg-dev g++ xgraph
sudo apt-get install g++-4.4
2.将下载好的tar包放到自己想要放置的位置,然后在Terminal进入ns-allinone-2.35文件夹下直接安装
sudo ./install
3.漫长的等待后会出现类似
Please put/usr/local/ns2/ns-allinone-2.34/bin:/usr/local/ns2/ns-allinone-2.34/tcl8.4.18/unix:/usr/local/ns2/ns-allinone-2.34/tk8.4.18/unix
into yourPATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
IMPORTANTNOTICES:
(1) YouMUST put /usr/local/ns2/ns-allinone-2.34/otcl-1.13,/usr/local/ns2/ns-allinone-2.34/lib,
intoyour LD_LIBRARY_PATH environment variable.
Ifit complains about X libraries, add path to your X libraries
intoLD_LIBRARY_PATH.
Ifyou are using csh, you can set it like:
setenvLD_LIBRARY_PATH <paths>
Ifyou are using sh, you can set it like:
exportLD_LIBRARY_PATH=<paths>
(2) YouMUST put /usr/local/ns2/ns-allinone-2.34/tcl8.4.18/library into yourTCL_LIBRARY environmental
variable.Otherwise ns/nam will complain during startup.
Afterthese steps, you can now run the ns validation suite with
cdns-2.34; ./validate
Fortrouble shooting, please first read ns problems page
http://www.isi.edu/nsnam/ns/ns-problems.html.Also search the ns mailing list archive
forrelated posts.
root@www.linuxidc.com:/usr/local/ns2/ns-allinone-2.34#
表明你安装成功了。这时只需更改几个参数:
先输入gedit ~/.bashrc
之后在文本的最后添加
exportPATH="$PATH:/usr/local/ns2/ns-allinone-2.35/bin:/usr/local/ns2/ns-allinone-2.35/tcl8.5.10/unix:/usr/local/ns2/ns-allinone-2.35/tk8.5.10/unix"
exportLD_LIBRARY_PATH="/usr/local/ns2/ns-allinone-2.35/otcl-1.14:/usr/local/ns2/ns-allinone-2.35/lib"
exportTCL_LIBRARY="$TCL_LIBRARY:usr/local/ns2/ns-allinone-2.35/tcl8.5.10/library"
红字部分是相对路径,请更改为自己安装的路径。
之后在Terminal输入ns,显示%就表示运行成功了。可以编辑一个test.tcl文件,里面输入手册一开始提到的例子:
# The preamble
set ns [new Simulator]
;# initialise the simulation
# Predefine tracing
set f [open out.tr w]
$ns trace-all $f
set nf [open out.nam w]
$ns namtrace-all $nf
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
$ns duplex-link $n0 $n2 5Mb2ms DropTail
$ns duplex-link $n1 $n2 5Mb2ms DropTail
$ns duplex-link $n2 $n31.5Mb 10ms DropTail
# Some agents.
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
set cbr0 [newApplication/Traffic/CBR]
$cbr0 attach-agent $udp0
$udp0 set class_ 0
;# A UDP agent
;# on node $n0
;# A CBR traffic generatoragent
;# attached to the UDP agent
;# actually, the default,but. . .
;# Its sink
;# on node $n3
set null0 [new Agent/Null]
$ns attach-agent $n3 $null0
$ns connect $udp0 $null0
$ns at 1.0 "$cbr0start"
puts [$cbr0 set packetSize_]
puts [$cbr0 set interval_]
# A FTP over TCP/Tahoe from$n1 to $n3, flowid 2
set tcp [new Agent/TCP]
$tcp set class_ 1
$ns attach-agent $n1 $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $n3 $sink
;# TCP does not generate itsown traffic
set ftp [newApplication/FTP]
$ftp attach-agent $tcp
$ns at 1.2 "$ftpstart"
$ns connect $tcp $sink
$ns at 1.35 "$nsdetach-agent $n0 $tcp ; $ns detach-agent $n3 $sink"
# The simulation runs for3s.
# The simulation comes to anend when the scheduler invokes the finish{} procedure below.
# This procedure closes alltrace files, and invokes nam visualization on one of the trace files.
$ns at 3.0"finish"
proc finish {} {
global ns f nf
$ns flush-trace
close $f
close $nf
puts "runningnam..."
exec nam out.nam &
exit 0
}
# Finally, start thesimulation.
$ns run
保存之后,Terminal进入文件所在文件夹,运行ns test.tcl,如果成功会打开nam显示模拟情况。
最后,补充一个有用的软件gnuplot,画图利器。
sudo apt-get install gnuplot
源文档 <http://www.linuxidc.com/Linux/2012-03/55990.htm>
相关文章推荐
- Ubuntu 安装ns2.35+nam
- ubuntu14.04上安装ns-allinone-2.35
- Ubuntu10.04下安装ns-allinone-2.35
- Ubuntu 13.04 安装ns2.35
- ubuntukylin14安装ns-allinone-2.35教程(虚拟机ubuntu同理)
- linux中文输入法&&NS2.35在ubuntu上安装
- 物联网仿真 ns-allinone-2.35 安装教程 ubuntu16.04下安装 与使用
- SUMO仿真快速入门系列四:Ubuntu 12.04 安装ns2.35
- ubuntu14.3下安装ns2.35安装详解
- Ubuntu16.04下安装ns2.35
- ubuntu14.04下安装ns2.35 的问题
- 在ubuntu 11.10下安装ns2-allinone-2.35.tar.gz
- Ubuntu16.04下安装ns2.35
- Ubuntu 14.04下安装ns-2.35详细教程
- Ubuntu14.04下安装NS2.35
- 在win7_64bit + ubuntu-12.04-desktop-amd64+VMware-workstation-full-10.0.1-1379776平台上安装ns-allinone-2.35
- ns-allinone-2.35在ubuntu14.04环境下的安装
- NS-2.35在ubuntu 11.04下的安装
- Ubuntu16.04安装ns-allinone-2.35
- ubuntu 13.10安装ns2.35详解