一、首先在Ubuntu中预先安装相关依赖:
udo apt-get install gcc g++ Python
sudo apt-get install mercurial
sudo apt-get install bzr
sudo apt-get install gdb valgrind
sudo apt-get install gsl-bin libgsl0-dev libgsl0ldbl
sudo apt-get install flex bison
sudo apt-get install g++-3.4 gcc-3.4
sudo apt-get install tcpdump
sudo apt-get install sqlite sqlite3 libsqlite3-dev
sudo apt-get install libxml2 libxml2-dev
sudo apt-get install libgtk2.0-0 libgtk2.0-dev
sudo apt-get install vtun lxc
sudo apt-get install uncrustify
sudo apt-get install doxygen graphviz imagemagick
sudo apt-get install texlive texlive-pdf texlive-latex-extra texlive-generic-extra texlive-generic-recommended
sudo apt-get install texinfo dia texlive texlive-pdf texlive-latex-extra texlive-extra-utils texlive-generic-recommended
sudo apt-get install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev
sudo apt-get install libboost-signal-dev libboost-filesystem-dev
二、安装NS3
在官网(www.nsnam.org)上下载NS3安装包并解压,下载的版本为ns-allinone-3.24.1.tar.bz2(https://www.nsnam.org/release/ns-allinone-3.24.1.tar.bz2)
1、在终端运行以下命令进行解压;
bzip2 -d ns-allinone-3.24.1.tar.bz2
tar xvf ns-allinone-3.24.1.tar
2、然后,进入解压文件夹执行命令:
./build.py
3、进入ns-3.24.1目录使用waf构建:
./waf -d optimized configure
./waf -d debug configure
./waf
./waf -d debug --enable-sudo configure
三、运行脚本,进入ns-3.24.1目录:
./waf -run hello-simulator
会输出如下信息:hello simulator