Ubuntu中安装ns3

有问题可看看官网的依赖环境链接<很重要>

Ubuntu/Debian/Mint
The following list of packages should be accurate through the Ubuntu 21.04 release; other releases or other Debian-based systems may slightly vary. Ubuntu 16.04 LTS release is probably the oldest release that is known to work with the most recent ns-3 releases.

Note: As of ns-3.30 release (August 2019), ns-3 uses Python 3 by default, but earlier releases depend on Python 2 packages, and at least a Python 2 interpreter is recommended. If working with an earlier release, one may in general substitute ‘python’ for ‘python3’ in the below (e.g. install ‘python-dev’ instead of ‘python3-dev’).

minimal requirements for C++ users (release 3.35 and earlier): This is the minimal set of packages needed to run ns-3 from a released tarball.

 apt install g++ python3

Note: As of January 2022 (ns-3.36 release and ns-3-dev), the minimum g++ version is g+±8. Older Ubuntu releases (18.04, 16.04) come with an older default g++. On Ubuntu 18.04, this StackOverflow answer can be followed to install and prefer g+±8: https://askubuntu.com/a/1028656. On older Ubuntu such as 16.04, to use the most recent code, you must install g+±8 or g+±9 from the Ubuntu toolchain:

https://launchpad.net/%7Eubuntu-toolchain-r/+archive/ubuntu/test

minimal requirements for C++ users (release 3.36 and development): For ns-3-dev and ns-3.36 (and later) releases, CMake is also needed.
apt install g++ python3 cmake
minimal requirements for Python API users (release 3.30 and newer, and ns-3-dev): This is the minimal set of packages needed to work with Python bindings from a released tarball.
apt install g++ python3 python3-dev pkg-config sqlite3 cmake
additional minimal requirements for Python (development): For use of ns-3-allinone repository (cloned from Git), additional packages are needed to fetch and successfully install pybindgen and netanim.
apt install python3-setuptools git
Netanim animator: qt5 development tools are needed for Netanim animator; qt4 will also work but we have migrated to qt5.
apt install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
Note: For Ubuntu 20.10 and earlier, the single ‘qt5-default’ package suffices

apt install qt5-default
Support for ns-3-pyviz visualizer
For Ubuntu 18.04 and later, python-pygoocanvas is no longer provided. The ns-3.29 release and later upgrades the support to GTK+ version 3, and requires these packages:
apt install gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3
For ns-3.28 and earlier releases, PyViz is based on GTK+ 2, GooCanvas, and GraphViz:
apt install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev ipython
Support for MPI-based distributed emulation
apt install openmpi-bin openmpi-common openmpi-doc libopenmpi-dev
Support for bake build tool:
apt install autoconf cvs bzr unrar
Debugging:
apt install gdb valgrind
Support for utils/check-style.py code style check program
apt install uncrustify
Doxygen and related inline documentation:

apt install doxygen graphviz imagemagick
apt install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils dvipng latexmk

If you get an error such as ‘convert … not authorized source-temp/figures/lena-dual-stripe.eps’, see this post about editing ImageMagick’s security policy configuration: https://cromwell-intl.com/open-source/pdf-not-authorized.html. In brief, you will want to make this kind of change to ImageMagick security policy:

 --- ImageMagick-6/policy.xml.bak	2020-04-28 21:10:08.564613444 -0700
   +++ ImageMagick-6/policy.xml	2020-04-28 21:10:29.413438798 -0700
   @@ -87,10 +87,10 @@
      <policy domain="path" rights="none" pattern="@*"/>

   -  <policy domain="coder" rights="none" pattern="PS" />

   +  <policy domain="coder" rights="read|write" pattern="PS" />
      <policy domain="coder" rights="none" pattern="PS2" />
      <policy domain="coder" rights="none" pattern="PS3" />
      <policy domain="coder" rights="none" pattern="EPS" />

   -  <policy domain="coder" rights="none" pattern="PDF" />

   +  <policy domain="coder" rights="read|write" pattern="PDF" />
      <policy domain="coder" rights="none" pattern="XPS" />

    </policymap>

The ns-3 manual and tutorial are written in reStructuredText for Sphinx (doc/tutorial, doc/manual, doc/models), and figures typically in dia (also needs the texlive packages above):
apt install python3-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”.

GNU Scientific Library (GSL) support for more accurate 802.11b WiFi error models (not needed for OFDM):
apt install gsl-bin libgsl-dev libgslcblas0
If the above doesn’t work (doesn’t detect GSL on the system), consult: https://coral.ise.lehigh.edu/jild13/2016/07/11/hello/. But don't worry if you are not using 802.11b models.

To read pcap packet traces
apt install tcpdump
Database support for statistics framework
apt install sqlite sqlite3 libsqlite3-dev
Xml-based version of the config store (requires libxml2 >= version 2.7)
apt install libxml2 libxml2-dev
Support for generating modified python bindings
apt install cmake libc6-dev libc6-dev-i386 libclang-dev llvm-dev automake python3-pip
python3 -m pip install --user cxxfilt
and you will want to install castxml and pygccxml as per the instructions for python bindings (or through the bake build tool as described in the tutorial). The ‘castxml’ and ‘pygccxml’ packages provided by Ubuntu 18.04 and earlier are not recommended; a source build (coordinated via bake) is recommended. If you plan to work with bindings or rescan them for any ns-3 C++ changes you might make, please read the chapter in the manual on this topic.

Note: Ubuntu versions (through 19.04) and systems based on it (e.g. Linux Mint 18) default to an old version of clang and llvm (3.8), when simply ‘libclang-dev’ and ‘llvm-dev’ are specified. The packaging on these 3.8 versions is broken. Users of Ubuntu will want to explicitly install a newer version by specifying ‘libclang-6.0-dev’ and ‘llvm-6.0-dev’. Other versions newer than 6.0 may work (not tested).

A GTK-based configuration system
apt install libgtk-3-dev
To experiment with virtual machines and ns-3
apt install vtun lxc uml-utilities
Support for openflow module (requires libxml2-dev if not installed above) and Boost development libraries
apt install libxml2 libxml2-dev libboost-all-dev

# run: yes|sh bash.sh
apt install gsl-bin libgsl-dev libgslcblas0
apt install tcpdump
apt install sqlite sqlite3 libsqlite3-dev
apt install libxml2 libxml2-dev
apt install cmake libc6-dev libc6-dev-i386 libclang-dev llvm-dev automake python3-pip

apt install libgtk-3-dev
apt install vtun lxc uml-utilities
apt install libxml2 libxml2-dev libboost-all-dev
apt install doxygen graphviz imagemagick
apt install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils dvipng latexmk
apt install python3-sphinx dia 
apt install gdb valgrind
apt install gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 install g++ python3 
apt install g++ python3 cmake g++ python3 python3-dev pkg-config sqlite3 cmake  python3-setuptools git qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools install qt5-default
python3 -m pip install --user cxxfilt

run yes|sh bash.sh

./build.py  --enable-examples --enable-tests --python=/usr/bin/python --with-pybindgen=/home/dell/ns-allinone-3.36.1/pybindgen-0.22.1
cd ns3
./waf
./test.py -c core

reconfigure

cd ns3
./waf  configure --enable-examples --enable-test --with-pybindgen=/home/dell/ns-allinone-3.36.1/pybindgen-0.22.1
./waf
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值