自己实践了一下在linux下安装ns2,很顺利;
默认安装好的xubuntu8.04下:
到或等地方下载ns-allinone-2.33.tar.gz
因为ubuntu的source没有ns2;
#wget-curl;
下载过程中可以安装相关的库等:
#sudoapt-getinstallbuild-essential
#sudoapt-getinstalltcl8.4tcl8.4-devtk8.4tk8.4-dev
#sduoapt-getinstalllibxmu-devlibxmu-headers
可以把解压缩后的源码放到欲安装的位置。例如:
#sudomkdir/usr/local/NS2
#tarxvfzns-allinone-2.33.tar.gz
#sudomvns-allinone-2.33/*/usr/local/NS2
#cdNS2
#sudo./install
安装完后,注意提示:
IMPORTANTNOTICES:
(1)YouMUSTput/usr/local/NS2/otcl-1.13,/usr/local/NS2/lib,
intoyourLD_LIBRARY_PATHenvironmentvariable.
IfitcomplainsaboutXlibraries,addpathtoyourXlibraries
intoLD_LIBRARY_PATH.
Ifyouareusingcsh,youcansetitlike:
setenvLD_LIBRARY_PATH
Ifyouareusingsh,youcansetitlike:
exportLD_LIBRARY_PATH=
(2)YouMUSTput/usr/local/NS2/tcl8.4.18/libraryintoyourTCL_LIBRARYenvironmental
variable.Otherwisens/namwillcomplainduringstartup.
Afterthesesteps,youcannowrunthensvalidationsuitewith
cdns-2.33;./validate
可以在shell下添加更新环境变量,或者在~/.bashrc尾部添加:
exportPATH=$PATH:/usr/local/NS2/bin:/usr/local/NS2/tcl8.4.184/unix:/usr/local/NS2/tk8.4.18/unix
exportLD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/NS2/otcl-1.13:/usr/local/NS2/lib
exportTCL_LIBRARY=$TCL_LIBRARY:/usr/local/NS2/tcl8.4.18/library
对于是.cshrc,方式为:
setpath=(/sbin/bin/usr/sbin/usr/bin/usr/local/sbin/usr/local/bin/usr/X11R6/bin
$HOME/bin/usr/local/NS2/bin/usr/local/NS2/tcl8.4.18/unix/usr/local/NS2/tk8.4.18/unix)
setenvLD_LIBRARY_PATH/usr/local/NS2/otcl-1.13:/usr/local/NS2/lib
setenvTCL_LIBRARY/usr/local/NS2/tcl8.4.18/library
做验证安装情况:
#cd/usr/local/NS2/ns-2.31
#./validate
验证OK;
#ns
%
......ok......