整理了下安装配置ns2的过程:
1、在https://下载解压ns2-allinone-2.35.tar.gz,如果觉得文件名太长,替换文件名mv ns2-allinone-2.35 ns
2、cd ns先修改gedit ns-2.35/linkstate/ls.h 中的 void eraseAll() { erase(baseMap::begin(), baseMap::end()); } 改为 void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }
3、根据二楼版主的方法修改源
阿里源
deb http://mirrors. bionic main restricted universe multiverse
deb http://mirrors. bionic-security main restricted universe multiverse
deb http://mirrors. bionic-updates main restricted universe multiverse
deb http://mirrors. bionic-proposed main restricted universe multiverse
deb http://mirrors. bionic-backports main restricted universe multiverse
deb-src http://mirrors. bionic main restricted universe multiverse
deb-src http://mirrors. bionic-security main restricted universe multiverse
deb-src http://mirrors. bionic-updates main restricted universe multiverse
deb-src http://mirrors. bionic-proposed main restricted universe multiverse
deb-src http://mirrors. bionic-backports main restricted universe multiverse
清华源
deb https://mirrors.tuna.tsinghua. bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua. bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua. bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua. bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua. bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua. bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua. bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua. bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua. bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua. bionic-proposed main restricted universe multiverse
然后更新
sudo apt-get update
sudo apt-get upgrade
4、sudo apt-get install build-essential autoconf automake libxmu-dev获取NS2安装依赖的包
5、./install安装
6、配置环境
gedit ~/.bashrc
根据文件所属路径配置
source ~/.bashrc
7、输入ns验证
如果是%则成功
如果显示如图
输入apt-get install ns2回车,输入y回车
然后再输入ns验证
成功,泪目