sudo apt-get update sudo apt install gcc g++ python sudo apt install gcc g++ python python-dev sudo apt install mercurial sudo apt install bzr sudo apt install gdb valgrind sudo apt install gsl-bin libgsl0-dev libgsl0ldbl sudo apt install flex bison libfl-dev sudo apt install g++-3.4 gcc-3.4 sudo apt install tcpdump sudo apt install sqlite sqlite3 libsqlite3-dev sudo apt install libxml2 libxml2-dev sudo apt install libgtk2.0-0 libgtk2.0-dev sudo apt install vtun lxc sudo apt install uncrustify sudo apt install doxygen graphviz imagemagick sudo apt install texlive texlive-extra-utils texlive-latex-extra sudo apt install python-sphinx dia sudo apt install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev sudo apt install libboost-signals-dev libboost-filesystem-dev sudo apt install openmpi*
对上面代码的解释:
#C++和python安装,必装 sudo apt install gcc g++ python sudo apt install gcc g++ python python-dev #NS3代码维护使用的源码版本控制管理系统 sudo apt install mercurial #运行python绑定ns-3-dev需要bazaar这个组件 sudo apt install bzr #调试工具 sudo apt install gdb valgrind #支持更多精确WIFI模块的GNU Scientific Library (GSL) sudo apt install gsl-bin libgsl0-dev libgsl0ldbl #仿真必需的词法分析器和语法分析生成器,必装 sudo apt install flex bison libfl-dev #一些Network Simulation Cradle (nsc) stacks需要gcc-3.4 sudo apt install g++-3.4 gcc-3.4 #读取pcap的packet traces,即包嗅探器 sudo apt install tcpdump #支持统计特性的数据库软件 sudo apt install sqlite sqlite3 libsqlite3-dev #xml的配置存储软件(requires libxml2 >= version 2.7) sudo apt install libxml2 libxml2-dev #基于GTK的配置系统 sudo apt install libgtk2.0-0 libgtk2.0-dev #在虚拟机and ns-3上测试 sudo apt install vtun lxc #支持utils/check-style.py 代码风格检查程序 sudo apt install uncrustify #文档生成器,从源代码中生成说明文档(很大,我没有装) sudo apt install doxygen graphviz imagemagick sudo apt install texlive texlive-extra-utils texlive-latex-extra #The ns-3 manual and tutorial are written in reStructuredText for Sphinx (doc/tutorial, doc/manual, doc/models), and figures typically in dia: sudo apt install python-sphinx dia #Note: Sphinx version >= 1.12 required for ns-3.15. To check your version, type “sphinx-build”. To fetch this package alone, outside of the Ubuntu package system, try “sudo easy_install -U Sphinx”. #Gustavo’s ns-3-pyviz的可视化软件(没装) sudo apt install python-pygraphviz python-kiwi python- - pygoocanvas libgoocanvas-dev #支持openflow 模块(requires some boost libraries) sudo apt install libboost-signals-dev libboost-filesystem-dev #支持基于 MPI的分布式仿真 sudo apt-get install openmpi*2. 安装&编译NS3
mkdir NS3 # 我创建的NS3目录的完整路径是/home/lenovo/NS3/,可自行创建在其他目录下。 cd NS3 wget wget https://www.nsnam.org/releases/ns-allinone-3.35.tar.bz2 tar xvf ns-allinone-3.35.tar.bz2 cd ns-allinone-3.35/ sudo ./build.py #耐心等待。 # 看到'build' finished successfully..... 就表示安装成功 cd ns-3.35/ #注意不是ns-allinone-3.35/ sudo ./waf distclean #清除整个build目录 sudo ./waf configure --enable-examples --enable-tests #开启例子及帮助 sudo ./waf build #耐心等待3.测试
sudo ./test.py #看到一堆PASS就证明安装成功 sudo ./test.py -c core #看到一堆PASS就证明安装成功4.运行程序
sudo ./waf --run hello-simulator
会打印如下内容:
reference1
reference2



