在win7_64bit + ubuntu-12.04-desktop-amd64+VMware-workstation-full-10.0.1-1379776平台上安装ns-allinone-2.35

step1.  ns-allinone-2.35的下载地址:http://www.isi.edu/nsnam/ns/ns-build.html#allinone

step2.  在虚拟机中打开terminal。打开terminal的快捷方式:ctr+shift+t

step3.  #sudo apt-get update     //新安装的系统先运行一下,避免出现软件依赖的错误

step4.  # sudo apt-get install build-essential

step5.  # sudo apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev

step6.  # sduo apt-get install libxmu-dev libxmu-headers

step7.  先将 ns-allinone-2.35.tar.gz安装包复制到:/Home, 再解压: tar -zxf ns-allinone-2.35.tar.gz。也可手动解压安装包。( 注意:如采用命令:sudo tar -xzf ns-allinone-2.35.tar.gz 进行加压,解压后的文件夹会有锁的标识)

step8.  cd ns-allinone-2.35 #定位到安装目录(解压之后的文件)
step9.  ./install #开始安装(注意:如采用命令:sudo ./install 进行安装,安装过程中创建的文件夹会有锁的标识)

....................................................

安装完成后提示

IMPORTANT NOTICES:
(1) You MUST put /home/ub-administrator/ns-allinone-2.35/otcl-1.14, /home/ub-administrator/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
/home/ub-administrator/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

step10.  sudo gedit ~/.bashrc #打开。bashrc文件,以便更改环境变量

step11.  在文件的尾部加入一下内容:

export PATH=$PATH:/home/ub-administrator/ns-allinone-2.35/bin:/home/ub-administrator/ns-allinone-2.35/tcl8.5.10/unix:/home/ub-administrator/ns-allinone-2.35/tk8.5.10/unix

export LD_LIBRARY_PATH=/home/ub-administrator/ns-allinone-2.35/otcl-1.14:/home/ub-administrator/ns-allinone-2.35/lib

export TCL_LIBRARY=/home/ub-administrator/ns-allinone-2.35/tcl8.5.10/library

注意:红色字体的内容来自安装完后的提示,即为You MUST put后面的路径。

step12.  保存.bashrc后关闭terminal,并重新打开terminal,再输入ns,出现%,则安装成功。

此外,如果输入:ns /home/ub-administrator/ns-allinone-2.35/ns-2.35/tcl/ex/simple.tcl 提示:

---------------------------------------------------start 信息提示---------------------------------------------------

running nam...
ub-administrator@ubadministrator-virtual-machine:~$ nam: Can't find a usable tk.tcl in the following directories:
    /home/ub-administrator/ns-allinone-2.35/tcl8.5.10/library/tk8.5 /home/ub-administrator/ns-allinone-2.35/tcl8.5.10/tk8.5 ./lib/tk8.5 /home/ub-administrator/ns-allinone-2.35/lib/tk8.5 ./library

...................................

This probably means that tk wasn't installed properly.

---------------------------------------------------end 信息提示---------------------------------------------------

这是因为没有安装nam. 输入:sudo apt-get install nam   安装成功后再验证即可。

如果遇到问题,可以重新执行 ./install。

上一篇:@property使用


下一篇:【转】JavaScript eval处理JSON数据 为什么要加括号