下载地址:http://www.isi.edu/nsnam/ns/ns-build.html
下载压缩包名并对其进行解压:
tar -zxvf ns-allinone-2.35.tar.gz
下载相关包:
yum install libX11-devel*
yum install xorg-x11-proto-devel*
yum install libXt-devel*
yum install libXmu-devel*
mkdir /usr/ns-2/NS-2 -p
将解压出来的ns-allinone-2.35移到/usr/ns-2/NS-2下
mv ns-allinone-2.35 /usr/ns-2/NS-2
vim /usr/ns-2/NS-2/ns-allinone-2.35/ns-2.35/linkstate/ls.h
将void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
改为:void eraseAll() { this->erase(baseMap::begin(), baseMap::end());
cd /usr/ns-2/NS-2/ns-allinone-2.35
./install
如出现以下内容则表示安装成功
----------------------------------------------------------------------------------
Please put /usr/ns-2/NS-2/ns-allinone-2.35/bin:/usr/ns-2/NS-2/ns-allinone-2.35/tcl8.5.10/unix:/usr/ns-2/NS-2/ns-allinone-2.35/tk8.5.10/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
IMPORTANT NOTICES:
(1) You MUST put /usr/ns-2/NS-2/ns-allinone-2.35/otcl-1.14, /usr/ns-2/NS-2/ns-allinone-2.35/lib,
into your LD_LIBRARY_PATH environment variable.
If it complains about X libraries, add path to your X libraries
into LD_LIBRARY_PATH.
If you are using csh, you can set it like:
setenv LD_LIBRARY_PATH
If you are using sh, you can set it like:
export LD_LIBRARY_PATH=
(2) You MUST put /usr/ns-2/NS-2/ns-allinone-2.35/tcl8.5.10/library into your TCL_LIBRARY environmental
variable. Otherwise ns/nam will complain during startup.
After these steps, you can now run the ns validation suite with
cd ns-2.35; ./validate
For trouble shooting, please first read ns problems page
http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive
for related posts.
进入配置文件
gedit .bashrc
添加
export PATH="$PATH:/usr/ns-2/NS-2/ns-allinone-2.35/bin:/usr/ns-2/NS-2/ns-allinone-2.35/tcl8.5.10/unix:/usr/ns-2/NS-2/ns-allinone-2.35/tk8.5.10/unix"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/ns-2/NS-2/ns-allinone-2.35/otcl-1.14:/usr/ns-2/NS-2/ns-allinone-2.35/lib"
export TCL_LIBRARY="$TCL_LIBRARY:/usr/ns-2/NS-2/ns-allinone-2.35/tcl8.5.10/library"
保存退出
生效
source ~/.bashrc
在终端输入ns,若出现%,并且输入nam后可以打开NAM程序,说明环境构建成功: