CentOS 6.5 安装NS-2

安装前先检测环境是否正确,必须安装的包是否都已经安装。

[koorey@maple ~]$yum install libX11-devel*
[koorey@maple ~]$yum install xorg-x11-proto-devel*
[koorey@maple ~]$yum install libXt-devel*
[koorey@maple ~]$yum install libXmu-devel* 

首先下载安装包


[root@slave2 ex]# wget --no-check-certificate http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.34/ns-allinone-2.34.tar.gz


创建安装路径


[root@slave2 ex]# cd /usr

[root@slave2 usr]# mkdir ns-2

[root@slave2 usr]# cd ns-2

[root@slave2 ns-2]# mkdir NS-2


解压安装包


[root@slave2 ex]# tar zxvf ns-allinone-2.34.tar.gz -C /usr/ns-2/NS-2


进入安装路径后执行安装脚本


[root@slave2 ex]# cd ns-allinone-2.34/

[root@slave2 ex]# ./install 


等待安装··· ···


安装结束时会输出一下信息:

Ns-allinone package has been installed successfully.
Here are the installation places:
tcl8.4.18: /usr/ns-2/NS-2/ns-allinone-2.34/{bin,include,lib}
tk8.4.18: /usr/ns-2/NS-2/ns-allinone-2.34/{bin,include,lib}
otcl: /usr/ns-2/NS-2/ns-allinone-2.34/otcl-1.13
tclcl: /usr/ns-2/NS-2/ns-allinone-2.34/tclcl-1.19
ns: /usr/ns-2/NS-2/ns-allinone-2.34/ns-2.34/ns
nam: /usr/ns-2/NS-2/ns-allinone-2.34/nam-1.14/nam
gt-itm:   /usr/ns-2/NS-2/ns-allinone-2.34/itm, edriver, sgb2alt, sgb2ns, sgb2comns, sgb2hierns

----------------------------------------------------------------------------------

Please put /usr/ns-2/NS-2/ns-allinone-2.34/bin:/usr/ns-2/NS-2/ns-allinone-2.34/tcl8.4.18/unix:/usr/ns-2/NS-2/ns-allinone-2.34/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 /usr/ns-2/NS-2/ns-allinone-2.34/otcl-1.13, /usr/ns-2/NS-2/ns-allinone-2.34/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 <paths>
    If you are using sh, you can set it like:
export LD_LIBRARY_PATH=<paths>


(2) You MUST put /usr/ns-2/NS-2/ns-allinone-2.34/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.34; ./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.

按照提示在/root/.bashrc 文件里加上环境变量后执行文件即可

[root@slave2 ex]# vim /root/.bashrc 

export NS_HOME=/usr/ns-2/NS-2/ns-allinone-2.34
export PATH=$PATH:/usr/ns-2/NS-2/ns-allinone-2.34/bin:/usr/ns-2/NS-2/ns-allinone-2.34/tcl8.4.18/unix:/usr/ns-2/NS-2/ns-allinone-2.34/tk8.4.18/unix
export LD_LIBRARY_PATH=/usr/ns-2/NS-2/ns-allinone-2.34/otcl-1.13:/usr/ns-2/NS-2/ns-allinone-2.34/lib:$LD_LIBRARY_PATH
export TCL_LIBRARY=/usr/ns-2/NS-2/ns-allinone-2.34/tcl8.4.18/library

保存并退出,然后执行文件

[root@slave2 ex]# source /root/.bashrc

以下步骤只是用来验证是否安装成功

[root@slave2 ex]# cd /usr/ns-2/NS-2/ns-allinone-2.34/ns-2.34/tcl/ex

[root@slave2 ex]# ns simple.tcl 

CentOS 6.5 安装NS-2_第1张图片

CentOS 6.5 安装NS-2_第2张图片


更多信息 访问: http://blog.csdn.net/maizi1045/article/details/50964021

你可能感兴趣的:(linux,脚本,ns-2)