最近在做网络协议研究,需要用到网络仿真器NS2,于是在Linux系统(Fedora 13)上安装之,相对Windows系统安装比较简单,但是过程中可能会遇到些小麻烦,先总结如下:
(一)下载NS的安装包,因为是菜鸟,入门选手,也许门还没入!所以我们那个实验书上推荐一次安装全部套件,一套安装下来好像要占用个200~300M的磁盘空间。到这个网站下载最新NS-allinone套件,我现在的最新套件是 ns-allinone-2.33 , 压缩包下载下来也有50M左右。
(二)配置系统环境。其实也不算配置,只是安装几个依赖包,没有这几个依赖包,我保证你100%不能把NS安装好。要安装依赖保,只需执行下面的命令。
#yum install gcc-c++
#yum install libX11-devel
#yum install xorg-x11-proto-devel
#yum install libXt-devel
上面是主程序的编译环境和依赖包,下面这条命令是nam的依赖包,当然如果你用数据就可以分析一个模拟网络,你可以NB的不安装!
#yum install libXmu-devel
(三)正式安装NS套件。思路: 随便进一个你的家目录下,解压套件的压缩包,软后执行安装命令,最后配置相应的环境变量。(假定我是安装在/home/mozhu/Public目录下的)
进入Public目录:
#cd /home/mozhu/Public
解压缩安装包:
#tar xvzf ns-allinone-2.33.tar.gz
进入解压缩后的文件夹:
#cd/home/mozhu/Public/ns-allinone-2.33
执行里面的一个安装文件,系统就自动安装所有的东西了:
#./install
安装完之后(得花个大几分钟的编译时间吧),会出现一些信息。如下:
Ns-allinone package has been installed successfully.
Here are the installation places:
tcl8.4.18: /home/mozhu/Public/ns-allinone-2.33/{bin,include,lib}
tk8.4.18: /home/mozhu/Public/ns-allinone-2.33/{bin,include,lib}
otcl: /home/mozhu/Public/ns-allinone-2.33/otcl-1.13
tclcl: /home/mozhu/Public/ns-allinone-2.33/tclcl-1.19
ns: /home/mozhu/Public/ns-allinone-2.33/ns-2.33/ns
nam: /home/mozhu/Public/ns-allinone-2.33/nam-1.13/nam
xgraph: /home/mozhu/Public/ns-allinone-2.33/xgraph-12.1
gt-itm: /home/mozhu/Public/ns-allinone-2.33/itm, edriver, sgb2alt, sgb2ns,sgb2comns, sgb2hierns
Please put /home/mozhu/Public/ns-allinone-2.33/bin:/home/mozhu/Public/ns-allinone-2.33/tcl8.4.18/unix:/home/mozhu/Public/ns-allinone-2.33/tk8.4.18/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
IMPORTANT NOTICES:
(1)You must put /home/mozhu/Public/ns-allinone-2.33/otcl-1.13,/home/mozhu/Public/ns-allinone-2.33/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 /home/mozhu/Public/ns-allinone-2.33/tcl8.4.18/library intoyour 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.33; ./validate
For trouble shooting, please first read ns problems page
search the ns mailing list archive
for related posts.