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, 再解压:sudo tar -xzf ns-allinone-2.35.tar.gz 。也可手动解压安装包。
step8. cd ns-allinone-2.35 #定位到安装目录(解压之后的文件)
step9. 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,出现%,则安装成功。
如果遇到问题,可以重新执行 ./install。