Linux安装NS3
2016-05-16 16:43
253 查看
我写的内容多是重复NS3官方文档里面的内容,如果看不懂我写的东西或我的内容与官方文档有冲突,以官方文档为准。建议大家多看看文档(程序员的必备技能)。
可以看到:
bake constants.py ns-3.25 README
build.py netanim-3.107 pybindgen-0.17.0.post49+ng0e4e3bc util.py
建议看看README。
执行
看到下面的内容说明你已经编译好了
Build commands will be stored in build/compile_commands.json
‘build’ finished successfully (12.537s)
Modules built:
antenna aodv applications
bridge buildings config-store
core csma csma-layout
dsdv dsr energy
fd-net-device flow-monitor internet
internet-apps lr-wpan lte
mesh mobility mpi
netanim (no Python) network nix-vector-routing
olsr point-to-point point-to-point-layout
propagation sixlowpan spectrum
stats tap-bridge test (no Python)
topology-read traffic-control uan
virtual-net-device wave wifi
wimax
Modules not built (see ns-3 tutorial for explanation):
brite click openflow
编译过程你可能会发现有红色字体出现,如(红色字体在这里用加粗字体表示)
—- Summary of optional NS-3 features:
Build profile : debug
Build directory :
Python Bindings : not enabled (Python library or headers missing)
BRITE Integration : not enabled (BRITE not enabled (see option –with-brite))
NS-3 Click Integration : not enabled (nsclick not enabled (see option –with-nsclick))
GtkConfigStore : enabled
XmlIo : enabled
Threading Primitives : enabled
Real Time Simulator : enabled
File descriptor NetDevice : enabled
Tap FdNetDevice : enabled
Emulation FdNetDevice : enabled
PlanetLab FdNetDevice : not enabled (PlanetLab operating system not detected (see option –force-planetlab))
Network Simulation Cradle : not enabled (NSC not found (see option –with-nsc))
MPI Support : not enabled (option –enable-mpi not selected)
NS-3 OpenFlow Integration : not enabled (OpenFlow not enabled (see option –with-openflow))
SQlite stats data output : enabled
Tap Bridge : enabled
PyViz visualizer : not enabled (Python Bindings are needed but not enabled)
Use sudo to set suid bit : not enabled (option –enable-sudo not selected)
Build tests : enabled
Build examples : enabled
GNU Scientific Library (GSL) : enabled
Gcrypt library : not enabled (libgcrypt not found: you can use libgcrypt-config to find its location.)
‘configure’ finished successfully (5.419s)
不用担心,这只是显示NS3的一些功能或特性没有启动(个人认为),不会影响NS3的安装。
首先进入文件夹ns-3.25
也可以看到有一个README文件,里面也有安装教程,可以看看。
继续编译
这一步是配置NS3,“–build-profile=debug”是让NS3以debug模式运行,可以在运行时查看日志信息,方便调试。最后出现
‘configure’ finished successfully (2.493s)
说明配置成功。接着编译
最后看到
Build commands will be stored in build/compile_commands.json
‘build’ finished successfully (7m41.748s)
Modules built:
antenna aodv applications
bridge buildings config-store
core csma csma-layout
dsdv dsr energy
fd-net-device flow-monitor internet
internet-apps lr-wpan lte
mesh mobility mpi
netanim (no Python) network nix-vector-routing
olsr point-to-point point-to-point-layout
propagation sixlowpan spectrum
stats tap-bridge test (no Python)
topology-read traffic-control uan
virtual-net-device wave wifi
wimax
Modules not built (see ns-3 tutorial for explanation):
brite click openflow
visualizer
说明编译成功。
执行之后,会把NS3的安装到其他的位置,文档是这么说的:
By default, the prefix for installation is /usr/local, so ./waf install will install programs into
/usr/local/bin, libraries into /usr/local/lib, and headers into /usr/local/include.
最后输出
219 of 222 tests passed (219 passed, 3 skipped, 0 failed, 0 crashed, 0 valgrind errors)
List of SKIPped tests:
ns3-tcp-cwnd
ns3-tcp-interoperability
nsc-tcp-loss
0 failed, 0 crashed, 0 valgrind errors,虽然有skipped,应该不影响使用。
好了,你已经安装成功了!
直接执行命令,如果出现
恭喜你,你可以使用NS3了!
如果没有出现,可能是配置NS3时,不是使用debug模式,而是”optimized”
那么控制台就不会输出
下载NS3
有多种下载NS3方式,最简单的是直接从官网下载NS3。从官网找到下载地址,下载安装包ns-allinone-3.25.tar.bz2,解压缩得到文件夹ns-allinone-3.25。不知道是什么原因,官网有时候连接不上,我给一个百度网盘的地址http://pan.baidu.com/s/1bplwXsV安装前准备
安装NS3需要许多软件的支持,比如Python。网址https://www.nsnam.org/wiki/Installation介绍了不同系统需要安装什么软件支持,有提供下载安装方式。其实它就是NS3的详细的安装教程,你可以直接阅读教程而不需要看我的这篇文章。编译
安装NS3也有多种方式。(下面的操作许多都要管理员权限,先su获取管理员权限吧)使用build.py编译
最简单的是build.py。进入文件夹ns-allinone-3.25cd ns-allinone-3.25 ls
可以看到:
bake constants.py ns-3.25 README
build.py netanim-3.107 pybindgen-0.17.0.post49+ng0e4e3bc util.py
建议看看README。
执行
./build.py --enable-examples --enable-tests
看到下面的内容说明你已经编译好了
Build commands will be stored in build/compile_commands.json
‘build’ finished successfully (12.537s)
Modules built:
antenna aodv applications
bridge buildings config-store
core csma csma-layout
dsdv dsr energy
fd-net-device flow-monitor internet
internet-apps lr-wpan lte
mesh mobility mpi
netanim (no Python) network nix-vector-routing
olsr point-to-point point-to-point-layout
propagation sixlowpan spectrum
stats tap-bridge test (no Python)
topology-read traffic-control uan
virtual-net-device wave wifi
wimax
Modules not built (see ns-3 tutorial for explanation):
brite click openflow
编译过程你可能会发现有红色字体出现,如(红色字体在这里用加粗字体表示)
—- Summary of optional NS-3 features:
Build profile : debug
Build directory :
Python Bindings : not enabled (Python library or headers missing)
BRITE Integration : not enabled (BRITE not enabled (see option –with-brite))
NS-3 Click Integration : not enabled (nsclick not enabled (see option –with-nsclick))
GtkConfigStore : enabled
XmlIo : enabled
Threading Primitives : enabled
Real Time Simulator : enabled
File descriptor NetDevice : enabled
Tap FdNetDevice : enabled
Emulation FdNetDevice : enabled
PlanetLab FdNetDevice : not enabled (PlanetLab operating system not detected (see option –force-planetlab))
Network Simulation Cradle : not enabled (NSC not found (see option –with-nsc))
MPI Support : not enabled (option –enable-mpi not selected)
NS-3 OpenFlow Integration : not enabled (OpenFlow not enabled (see option –with-openflow))
SQlite stats data output : enabled
Tap Bridge : enabled
PyViz visualizer : not enabled (Python Bindings are needed but not enabled)
Use sudo to set suid bit : not enabled (option –enable-sudo not selected)
Build tests : enabled
Build examples : enabled
GNU Scientific Library (GSL) : enabled
Gcrypt library : not enabled (libgcrypt not found: you can use libgcrypt-config to find its location.)
‘configure’ finished successfully (5.419s)
不用担心,这只是显示NS3的一些功能或特性没有启动(个人认为),不会影响NS3的安装。
使用Waf编译
文档推荐使用Waf编译NS3。首先进入文件夹ns-3.25
cd ns-allinone-3.25/ns-3.25 ls
也可以看到有一个README文件,里面也有安装教程,可以看看。
继续编译
./waf clean ./waf --build-profile=debug --enable-examples --enable-tests configure
这一步是配置NS3,“–build-profile=debug”是让NS3以debug模式运行,可以在运行时查看日志信息,方便调试。最后出现
‘configure’ finished successfully (2.493s)
说明配置成功。接着编译
./waf
最后看到
Build commands will be stored in build/compile_commands.json
‘build’ finished successfully (7m41.748s)
Modules built:
antenna aodv applications
bridge buildings config-store
core csma csma-layout
dsdv dsr energy
fd-net-device flow-monitor internet
internet-apps lr-wpan lte
mesh mobility mpi
netanim (no Python) network nix-vector-routing
olsr point-to-point point-to-point-layout
propagation sixlowpan spectrum
stats tap-bridge test (no Python)
topology-read traffic-control uan
virtual-net-device wave wifi
wimax
Modules not built (see ns-3 tutorial for explanation):
brite click openflow
visualizer
说明编译成功。
安装
这一步不是必须的。缺少这一步,只能在ns-3.25文件夹中使用NS3,不能在ns-3.25文件夹以外的文件夹中使用NS3。我就没有执行这一步。./waf install
执行之后,会把NS3的安装到其他的位置,文档是这么说的:
By default, the prefix for installation is /usr/local, so ./waf install will install programs into
/usr/local/bin, libraries into /usr/local/lib, and headers into /usr/local/include.
测试
测试看看是否成功地安装好NS3:./test.py -c core
最后输出
219 of 222 tests passed (219 passed, 3 skipped, 0 failed, 0 crashed, 0 valgrind errors)
List of SKIPped tests:
ns3-tcp-cwnd
ns3-tcp-interoperability
nsc-tcp-loss
0 failed, 0 crashed, 0 valgrind errors,虽然有skipped,应该不影响使用。
好了,你已经安装成功了!
运行脚本
执行第一个程序(又是Hello world)./waf --run hello-simulator
直接执行命令,如果出现
Hello Simu a99b lator
恭喜你,你可以使用NS3了!
如果没有出现,可能是配置NS3时,不是使用debug模式,而是”optimized”
./waf --build-profile=optimized --enable-examples --enable-tests configure
那么控制台就不会输出
Hello Simulator。
相关文章推荐
- 从源码安装Mysql/Percona 5.5
- 在 AppImage、Flathub 和 Snapcraft 平台上搜索 Linux 应用
- 解决vc中unable to connect to the MKS:Internal error问题
- 杰奇一些安装详细说明文件,比官方更细
- 无线网卡安装DIY
- 网卡安装常见问题精解
- DB2数据库的安装
- CentOS下DB2数据库安装过程详解
- ghost安装系统软件硬盘安装器 安装ghost图文教程
- CentOS 6.3下编译安装Ruby 2.0笔记
- FREEBSD安装POSTGRESQL笔记
- Redis总结笔记(一):安装和常用命令
- FreeBSD 6.2 安装全程图解教程
- 安装Apache和PHP的一些补充
- Lua在windows下的安装及环境配置
- PHP 5.3.0 安装分析心得
- 关于MSSQL 2005的安装与补丁
- SQL 2008安装时出现从新启动计算机提示如何解决
- sql2008安装教程 SQL Server 2008 R2 安装图解
- 无法在com+ 目录中安装和配置程序集 错误:-2146233087的解决方法[已测]