Fedora 8.0 + NS-2.33安装过程札记


谁说64bits的机器装不好ns,在我看来,这些程序是运行在操作系统下的,ns能不能运行,现在只有操作系统说了算,你硬件的全部动作都被操作系统支配着,还管我能不能安装NS?

为了安装个NS (network simulation),这几天真是把我人都搞憔悴了。主要问题是出在不能自动安装nam这个小东西,问老师,搞不定!

下面是我的安装过程,简单的不能再简单!(不过,我不能保证其他的机器和系统和ns版本可以正常安装,没钱买机器作实验,只是我现有的实验环境 [AMD Athlon 64 x2 + Fedora 8.0] )

(一)下载NS的安装包,因为是菜鸟,入门选手,也许门还没入!所以我们那个实验书上推荐一次安装全部套件,一套安装下来好像要占用个200~300M的磁盘空间。到网站 http://www.isi.edu/nsnam/ns/ns-build.html 下载最新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 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.33; ./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

在那里面配置环境变量,内容如下:
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

export PATH="$PATH:/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"

export LD_LIBRARY_PATH="$LD_LIBRARY:/home/mozhu/Public/ns-allinone-2.33/otcl-1.13:/home/mozhu/Public/ns-allinone-2.33/lib"

export TCL_LIBRARY="$TCL_LIBRARY:/home/mozhu/Public/ns-allinone-2.33/tcl8.4.18/library"

补充完整之后,保存退出!这样一个完整的NS就安装好了。

(四)验证是否正确安装。网上好多转载贴说执行一个什么valide程序可以验证NS是否正确安装,还都一个劲的说什么验证 时间大约为15minites,我真服了这些人的水,转载也不注明,也不自己动哈脑子改下或自己实验下!其实2个步骤就基本可以确定是否正确安装了。开一个控制台,输入如下命令:

$ns

若出现一个%则主件安装成功;

再在/home/mozhu/Public/ns-allinone-2.33/ns-2.33/tcl/ex目录下找到simple.tcl文件,执行如下:

$ns /home/mozhu/Public/ns-allinone-2.33/ns-2.33/tcl/ex/simple.tcl

若出现网路模拟动画,恭喜,你的NS基本安装的差不多了,尽管放心用些菜鸟级别的功能吧。 (作者:wanglilife)

相关内容