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
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章