Ubuntu 18.04和16.04 安装 ns-3.29 脚本安装 ns3 和 Pyviz 显示

有关Ubuntu 18.04和16.04用 脚本 安装 NS3 和Pyviz 显示

    • 请确认你的 Ubuntu 系统是 16.04 还是 18.04。其次是,如果你之前换过源文件,那么请确保版本对应,最好是 16.04 和 18.04 的本来源,我对这个说明是比较有信心的,但是最好是去看官网安装指南,特别是Ubuntu 20.04版本的。
  • 一、 环境配置
  • 为了解决Pyviz 显示的问题,在安装的时候就注意环境的配置。
    • 1.1 Ubuntu 18.04
    • 1.2 脚本运行
    • 1.3 Ubuntu 16.04
      • 附: 18.04 的初始源,注意备份你原来的源:
  • 二、 安装NS3
  • 可视化修改

请确认你的 Ubuntu 系统是 16.04 还是 18.04。其次是,如果你之前换过源文件,那么请确保版本对应,最好是 16.04 和 18.04 的本来源,我对这个说明是比较有信心的,但是最好是去看官网安装指南,特别是Ubuntu 20.04版本的。

所有的说明和文档可下载

一、 环境配置

为了解决Pyviz 显示的问题,在安装的时候就注意环境的配置。

1.1 Ubuntu 18.04

官网的依赖环境链接
这是可选择,有的可以不装,已有的是下面脚本文件 environment.sh 中的;你也可以不用脚本运行,一行行去复制。

#!/bin/bash
 apt-get install gcc g++ python
apt-get install gcc g++ python python-dev
apt-get install mercurial python-setuptools git
apt-get install qt5-default
apt-get install gir1.2-goocanvas-2.0 python-gi python-gi-cairo python-pygraphviz python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython ipython3
apt-get install openmpi-bin openmpi-common openmpi-doc libopenmpi-dev
apt-get install autoconf cvs bzr unrar
apt-get install gdb valgrind
apt-get install uncrustify
apt-get install doxygen graphviz imagemagick
apt-get install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils texlive-lang-portuguese dvipng latexmk
apt-get install python-sphinx dia
apt-get install gsl-bin libgsl2 libgsl-dev
apt-get install flex bison libfl-dev
apt-get install tcpdump
apt-get install sqlite sqlite3 libsqlite3-dev
apt-get install libxml2 libxml2-dev
apt-get install cmake libc6-dev libc6-dev-i386 libclang-dev llvm-dev automake
apt-get install libgtk2.0-0 libgtk2.0-dev
apt-get install vtun lxc
apt-get install libboost-signals-dev libboost-filesystem-dev

1.2 脚本运行

  1. 保存脚本environment.sh,赋予其可执行权限(右键,属性)
  2. 打开终端输入:
    sudo –s
    输入你的密码:
  3. 运行脚本: yes|sh ./environment.sh

1.3 Ubuntu 16.04

为了解决Pyviz --viz 显示的问题,安装时

  1. 方法一:你可以换成 18.04 的源:

  2. 方法二:把配置环境中把 environment.sh 中:
    (18.04 配置)
    apt-get install gir1.2-goocanvas-2.0 python-gi python-gi-cairo python-pygraphviz python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython ipython3
    改成(16.04 配置)
    apt-get install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev ipython

  3. 执行 2 中的环境配置步骤

附: 18.04 的初始源,注意备份你原来的源:

#deb cdrom:[Ubuntu 18.04.2 LTS _Bionic Beaver_ - Release amd64 (20190210)]/ bionic main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic universe
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://cn.archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb http://security.ubuntu.com/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

二、 安装NS3

官网下载 ns-allinone-3.29.tar.bz2,解压,在文件夹下:
脚本安装,赋予权限

#!/bin/bash  
sudo ./build.py 
cd ns-3.29
./waf clean 
./waf -d debug --enable-examples --enable-tests configure
sudo ./waf 
./test.py -c core

这个版本是 ns-3.29 ,修改成你自己的版本。

可视化修改

4C++的可视化:
将 src/visualizer/visualizer/core.py 中第 528 行的

line_dash=GooCanvas.LineDash([10.0, 10.0 ]) 

修改为

line_dash=GooCanvas.CanvasLineDash.newv([10.0, 10.0 ])

你可能感兴趣的:(NS3,ns3网络仿真,flowmonitor模块设计)