打印

ns-3安装过程

[复制链接]
134|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
电子学长|  楼主 | 2018-9-21 10:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
ST, TE, ge, TI, AN
昨天倒腾了下,目测是把ns3装好了,贴一下安装过程吧,

系统: ubuntu-12.04-desktop-i386.iso

环境:Vmvare



一、前期准备

在安装之前,要先配置好环境

配置环境的过程中要保证能够联网,因为在配置环境的过程中系统要在网上下载各种安装包

按ctrl+alt+t进入终端,依次执行下列命令:

sudo apt-get install gcc g++ pythonsudo apt-get install mercurialsudo apt-get install bzr

sudo apt-get install gdb valgrind sudo apt-get install gsl-bin libgsl0-dev libgsl0ldblsudo apt-get install flex bisonsudo apt-get install g++  gccsudo apt-get install tcpdumpsudo apt-get install sqlite sqlite3 libsqlite3-devsudo apt-get install libxml2 libxml2-devsudo apt-get install libgtk2.0-0 libgtk2.0-devsudo apt-get install vtun lxcsudo apt-get install uncrustifysudo apt-get install doxygen graphviz imagemagicksudo apt-get install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-devsudo apt-get install libboost-signals-dev libboost-filesystem-dev



如果在执行上述指令时出现例如.......not found之类的错误提示,在终端下执行下述指令

sudo apt-get update

更新整个目录树之后,再重新执行配置环境的指令



配置好环境后下面的事情就容易了



二、tutorial提供了 Using Mercurial和Using Tarball两种方法安装,我使用的是第一种方法

(1)One practice is to create a directory called repos in one’s home directory under which one can keep local Mercurialrepositories. Hint: we will assume you do this later in the tutorial. If you adopt that approach, you can get a copy of

ns-3-allinone by typing the following into your Linux shell (assuming you have installed Mercurial):

cd

mkdir repos

cd repos

hg clone http://code.nsnam.org/ns-3-allinone

过程如下图所示:



(2)
After the clone command completes, you should have a directory called ns-3-allinone, the contents of which

should look something like the following:



(3)
Go ahead and change into the ns-3-allinone directory you created when you cloned that repository. We are now

going to use the download.py script to pull down the various pieces of ns-3 you will be using.

Go ahead and type the following into your shell (remember you can substitute the name of your chosen release number

instead of ns-3-dev – like "ns-3.10" if you want to work with a stable release).

./download.py -n ns-3-dev















(4)After the download.py script completes, you should have several new directories under

~/repos/ns-3-allinone:

Go ahead and change into ns-3-dev under your ~/repos/ns-3-allinone directory. You should see something

like the following there:





三、Building ns3也有两种方法:./build.py和./waf ,这里我使用的是./build.py

(1) Change into the directory you created in the download section above. If you downloaded using Mercurial you should

have a directory called ns-3-allinone under your ~/repos directory. If you downloaded using a tarball you

should have a directory called something like ns-allinone-3.13 under your ~/tarballs directory. Type the

following:

./build.py --enable-examples --enable-tests

You will see lots of typical compiler output messages displayed as the build script builds the various pieces you

downloaded. Eventually you should see the following magic words:





四、Testing ns-3

(1)You can run the unit tests of the ns-3 distribution by running the ”./test.py -c core” script,

./test.py -c core

These tests are run in parallel by waf. You should eventually see a report saying that,





This is the important message.

You will also see output from the test runner and the output will actually look something like,



。。。这个太多了,只贴这一张图片



五、Running a ScriptWe typically run scripts under the control of Waf. This allows the build system to ensure that the shared library paths

are set correctly and that the libraries are available at run time. To run a program, simply use the --run option in

Waf. Let’s run the ns-3 equivalent of the ubiquitous hello world program by typing the following:

./waf --run hello-simulator

Waf first checks to make sure that the program is built correctly and executes a build if required. Waf then executes

the program, which produces the following output.









搞定收工了,,,头都搞晕了,不知道那个图片顺序是不是正确的,反正后面就是按照教程上的来,,虽然是全英文的,但是很好看懂,各位加油哦

使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

424

主题

447

帖子

1

粉丝