系统相关
首页 > 系统相关> > Ubuntu20.04中安装ns3网络仿真器

Ubuntu20.04中安装ns3网络仿真器

作者:互联网

前言

安装前的准备工作

建议先了解一下ns3的文件结构

参考博客: https://blog.csdn.net/sinat_36418396/article/details/106605673

安装依赖前,进行 update 和一些可能用到的包

# Update ubuntu and install dev
RUN apt-get update -y && \
    apt-get install -y  apt-utils autoconf automake libxmu-dev libpcap-dev curl  gcc gdb  ipython3  python-tk

安装依赖

可以添加到脚本中运行,为了方便查看那个包安装失败,所以选择如下格式。
版本不同依赖可能有区别,具体以官网为准。如下为官网整理。

官网:https://www.nsnam.org/wiki/Installation#Ubuntu.2FDebian.2FMint

参考博客:https://blog.csdn.net/qq_43005180/article/details/106951199utm_source=app&app_version=4.16.0&utm_source=app

apt-get  install -y gir1.2-goocanvas-2.0 python-gi python-gi-cairo python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3  
apt-get  install -y g++ python3 
apt-get  install -y python3-dev pkg-config sqlite3  python3-setuptools git
apt-get  install -y  qt5-default mercurial 
apt-get  install -y gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3  
apt-get  install -y  openmpi-bin openmpi-common openmpi-doc libopenmpi-dev
apt-get  install -y  autoconf cvs bzr unrar
apt-get  install -y  gdb valgrind 
apt-get  install -y  uncrustify
apt-get  install -y  doxygen graphviz imagemagick texlive texlive-extra-utils texlive-latex-extra texlive-font-utils dvipng latexmk
apt-get  install -y  python3-sphinx dia gsl-bin libgsl-dev libgsl23 libgslcblas0 tcpdump sqlite sqlite3 libsqlite3-dev libxml2 libxml2-dev
apt-get  install -y  cmake libc6-dev libc6-dev-i386 libclang-6.0-dev llvm-6.0-dev automake python3-pip 
python3 -m pip install --user cxxfilt
apt-get  install -y  libgtk-3-dev vtun lxc uml-utilities 
apt-get  install -y libxml2 libxml2-dev libboost-all-dev

安装过程中缺少的依赖

RUN pip3  install  pygccxml castxml
#
RUN pip install pybindgen
RUN apt-get -y install dpdk dpdk-dev libdpdk-dev dpdk-igb-uio-dkms 
RUN apt-get install -y libtiff-dev  screen
RUN apt-get install -y curl libcurl4-openssl-dev

因为笔者需要安装cartopy,Cartopy是一个Python包,用于地理空间数据处理,以便生成地图和其他地理空间数据分析。自动安装过程中发现安装proj版本低,需要手动安装proj库 首先官网下载需要的版本

https://proj.org/download.html
安装命令如下

cd /proj-8.0.0
./configure \
&& make   \
&& make install 
或者# ./configure && make && make install

安装ns3

官网版本:https://www.nsnam.org/releases/

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

看到以下界面就表明build成功,缺少的模块如果需要用到,可以另行添加,如果期间出现红色字体,说明有些功能没有完成,不过不影响。

在这里插入图片描述

使用waf编译与测试

./waf configure --build-profile=debug --enable-mpi --enable-examples --enable-tests 
--out=build/debug_all

最后出现configure finished successfully

使用test.py测试:

sudo ./test.py -c core

运行经典的第一个脚本

sudo ./waf --run hello-simulator

如果出现 Hello Simulator 说明安装成功。
在这里插入图片描述

标签:Ubuntu20.04,get,仿真器,apt,dev,install,ns3,安装,python3
来源: https://blog.csdn.net/xiaowu_wu/article/details/121307272