一、ubuntu 20.04版本下的ndnSIM安装。
第一步:安装依赖
sudo apt install build-essential libsqlite3-dev libboost-all-dev libssl-dev git python3-setuptools castxml
sudo apt install gir1.2-goocanvas-2.0 gir1.2-gtk-3.0 libgirepository1.0-dev python3-dev python3-gi python3-gi-cairo python3-pip python3-pygraphviz python3-pygccxml
sudo pip3 install kiwi
第二步:安装ndnSIM和NS-3
mkdir ndnSIM
cd ndnSIM
git clone https://github.com/named-data-ndnSIM/ns-3-dev.git ns-3
git clone https://github.com/named-data-ndnSIM/pybindgen.git pybindgen
git clone --recursive https://github.com/named-data-ndnSIM/ndnSIM.git ns-3/src/ndnSIM
第三步:编译构建
cd ns-3
./waf configure --enable-examples
./waf
安装过程中git clone有可能链接失败,可能是网络原因造成的。
可参考换源:
以20.04换源(清华源)为例:
备份原来的源,将以前的源备份一下,以防以后需要用的。
sudo cp /etc/apt/sources.list /etc/apt/sources.list1
打开/etc/apt/sources.list文件,添加源,并保存。
sudo gedit /etc/apt/sources.list
在文件前面复制到文件最前面,如下代码:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
粘贴完之后,直接保存退出。
执行命令更新:
sudo apt-get update
sudo apt-get upgrade
或输入reboot重启虚拟机。
参考链接: Ubuntu 20.04更换清华源_ubuntu20.04换清华源_Blackrosetian的博客-CSDN博客
二、运行实例
测试:
执行以下命令:
./waf --run=ndn-simple --vis
出现如下结果:
执行以下命令:
./waf --run=ndn-grid --vis
出现如下结果:
至此,安装顺利完成。
在ndnSIM 安装过程中常常有各种困难,逐一查找解决办法,总会一一解决。
当安装完毕后记得保留虚拟机快照或者备份整个虚拟机。