ubuntu 13.10安装ns2.35详解



ubuntu 13.10安装ns2 2.35详解
关于Ubuntu 13.10的安装已经vmware tools的安装大家可以google或baidu一下,这里不赘述。我想说的是在ubuntu 13.10下ns2 2.35的安装,这个困扰了我许久的问题。


1. 下载 ns2.35,http://www.isi.edu/nsnam/ns/ns-build.html 下载后解压,放在 home/xx (这个就是的根目录)下, xx 是你的用户名 如下图


2. 更新源包,终端输入:sudo apt-get update step
3. 安装依赖包 
sudo apt-get install tcl8.5-dev tk8.5-dev 
sudo apt-get install build-essential autoconf automake 
sudo apt-get install perl xgraph libxt-dev libx11-dev libxmu-dev step 
4. 修改 ns-allinone-2.35/ns-2.35/linkstate 中 ls.h 文件的代码 ,
将     void eraseAll() { erase(baseMap::begin(), baseMap::end()); } 
改为: void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); } 
(注:)别修改成图面上方的了。
 
5. sudo ls /usr/bin/gcc* //查看系统已经安装的 gcc 版本。 Ubuntu 13.10 默认安装了 gcc-4.8 //和 gcc-4.8  export CC=gcc-4.8 
export CXX=g++-4.8 //CC 和 CXX 是全局变量,用来指定 make 将会用哪个版本的 gcc/g++编译器生成 //makefile 文件。如果没有这一步,保证你会 makefile 失败!!因为,在 ns-2.35 文件夹 ! //下的 makefile.in 中要求配置全局变量。 echo $CC echo $CXX //查看全局变量导入成功了没有,如果成功,则执行 sudo ./install //开始进行安装,大概等 5 分钟左右。 ....... 出现以下的内容,每个人的/home/xx/不同,我的用户名是 nan,所以,显示了以下信息。
 Ns-allinone package has been installed successfully. 
Here are the installation places: tcl8.5.10: /home/nan/ns-allinone-2.35/{bin,include,lib} tk8.5.10: /home/nan/ns-allinone-2.35/{bin,include,lib}
 otcl: /home/nan/ns-allinone-2.35/otcl-1.14 
tclcl: /home/nan/ns-allinone-2.35/tclcl-1.20 
ns: /home/nan/ns-allinone-2.35/ns-2.35/ns
 nam:/home/nan/ns-allinone-2.35/nam-1.15/nam 
xgraph: /home/nan/ns-allinone-2.35/xgraph-12.2
 gt-itm: /home/nan/ns-allinone-2.35/itm, edriver, sgb2alt, sgb2ns, sgb2comns, sgb2hierns


 
Please put /home/nan/ns-allinone-2.35/bin:/home/nan/ns-allinone-2.35/tcl8.5.10/unix:/home/nan/ns-allin one-2.35/tk8.5.10/unix into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
 IMPORTANT NOTICES: (1) You MUST put /home/nan/ns-allinone-2.35/otcl-1.14, /home/nan/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 <paths> If you are using sh, you can set it like: export LD_LIBRARY_PATH=<paths> 
(2) You MUST put /home/nan/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 step
6. 根据提示设置环境变量。 
终端中输入 cd ,返回当前用户目录,然后
sudo gedit  .bashrc
,在.bashrc 文件尾部加入相应的代码。在文件末尾加入:
export PATH="$PATH:/home/a/ns-allinone-2.35/bin:/home/a/ns-allinone-2.35/tcl8.5.10/unix:/home/a/ns-allinone-2.35/tk8.5.10/unix" 
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/a/ns-allinone-2.35/otcl-1.14, /home/a/ns-allinone-2.35/lib" 
export TCL_LIBRARY="$TCL_LIBRARY:home/a/ns-allinone-2.35/tcl8.5.10/library "
上面红色的a是当前的用户名,改成自己的用户名就可以。
7. 测试
注销系统。
进入终端,输入ns,如果出现%,则说明安装成功
执行以下代码,会弹出一个简单的测试效果
代码: ns ./ns-allinone-2.35/ns-2.35/tcl/ex/simple.tcl

好啦,当你看到这个代表你成功!

总结一下,与君共勉,发表留言,共同进步!

参照:

http://11d16edb31127632f539936c.szrdedu.com/    Ubuntu 13.10 下安装 ns-2.35 及 leach 协议安装
http://forum.ubuntu.org.cn/viewtopic.php?f=122&t=449640   ubuntu 12.04 安装 ns2.35
 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值