Fedora13+ns2.34安裝指南

最近在做網絡協議研究,需要用到網絡仿真器NS2,於是在Linux系統上安裝之,相對windows系統安裝比較簡單,但是過程中可能會遇到些小麻煩,先總結如下:

(一)下載NS的安裝包,因爲是菜鳥,入門選手,也許門還沒入!所以我們那個實驗書上推薦一次安裝全部套件,一套安裝下來好像要佔用個200~300M的磁盤空間。到網站http://www.isi.edu/nsnam/ns/ns-build.html 下載最新NS-allinone套件,我現在的最新套件是 ns-allinone-2.33 , 壓縮包下載下來也有50M左右。

(二)配置系統環境。其實也不算配置,只是安裝幾個依賴包,沒有這幾個依賴包,我保證你100%不能把NS安裝好。要安裝依賴保,只需執行下面的命令。

#yum install gcc-c++
#yum install libX11-devel
#yum install xorg-x11-proto-devel
#yum install libXt-devel

上面是主程序的編譯環境和依賴包,下面這條命令是nam的依賴包,當然如果你用數據就可以分析一個模擬網絡,你可以NB的不安裝!

#yum install libXmu-devel

(三)正式安裝NS套件。思路: 隨便進一個你的家目錄下,解壓套件的壓縮包,軟後執行安裝命令,最後配置相應的環境變量。(假定我是安裝在/home/mozhu/Public目錄下的)

進入Public目錄:
#cd /home/mozhu/Public

解壓縮安裝包:
#tar xvzf ns-allinone-2.33.tar.gz

進入解壓縮後的文件夾:
#cd/home/mozhu/Public/ns-allinone-2.33

執行裏面的一個安裝文件,系統就自動安裝所有的東西了:
#./install

安裝完之後(得花個大幾分鐘的編譯時間吧),會出現一些信息。如下:

Ns-allinone package has been installed successfully.
Here are the installation places:
tcl8.4.18: /home/mozhu/Public/ns-allinone-2.33/{bin,include,lib}
tk8.4.18: /home/mozhu/Public/ns-allinone-2.33/{bin,include,lib}
otcl: /home/mozhu/Public/ns-allinone-2.33/otcl-1.13
tclcl: /home/mozhu/Public/ns-allinone-2.33/tclcl-1.19
ns: /home/mozhu/Public/ns-allinone-2.33/ns-2.33/ns
nam: /home/mozhu/Public/ns-allinone-2.33/nam-1.13/nam
xgraph: /home/mozhu/Public/ns-allinone-2.33/xgraph-12.1
gt-itm: /home/mozhu/Public/ns-allinone-2.33/itm, edriver, sgb2alt, sgb2ns,sgb2comns, sgb2hierns

Please put /home/mozhu/Public/ns-allinone-2.33/bin:/home/mozhu/Public/ns-allinone-2.33/tcl8.4.18/unix:/home/mozhu/Public/ns-allinone-2.33/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 /home/mozhu/Public/ns-allinone-2.33/otcl-1.13,/home/mozhu/Public/ns-allinone-2.33/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/mozhu/Public/ns-allinone-2.33/tcl8.4.18/library intoyour 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.33; ./validate

For trouble shooting, please first read ns problems page
http://www.isi.edu/nsnam/ns/ns-problems.htmlAlso search the ns mailing list archive
for related posts.

有了上面的信息之後,可以看出主要的東西都安裝成功了,接下來就是配置環境變量了。打開一個新的控制檯,

輸入如下命令:
$vim /root/.bashrc

在那裏面配置環境變量,內容如下:
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

export PATH="$PATH:/home/mozhu/Public/ns-allinone-2.33/bin:/home/mozhu/Public/ns-allinone-2.33/tcl8.4.18/unix:/home/mozhu/Public/ns-allinone-2.33/tk8.4.18/unix"

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/mozhu/Public/ns-allinone-2.33/otcl-1.13:/home/mozhu/Public/ns-allinone-2.33/lib"

export TCL_LIBRARY="$TCL_LIBRARY:/home/mozhu/Public/ns-allinone-2.33/tcl8.4.18/library"

補充完整之後,保存退出!這樣一個完整的NS就安裝好了。

(四)驗證是否正確安裝。網上好多轉載貼說執行一個什麼valide程序可以驗證NS是否正確安裝,還都一個勁的說什麼驗證 時間大約爲15minites,我真服了這些人的水,轉載也不註明,也不自己動哈腦子改下或自己實驗下!其實2個步驟就基本可以確定是否正確安裝了。開一個控制檯,輸入如下命令:

$ns

若出現一個%則主件安裝成功;

再在/home/mozhu/Public/ns-allinone-2.33/ns-2.33/tcl/ex目錄下找到simple.tcl文件,執行如下:

$ns /home/mozhu/Public/ns-allinone-2.33/ns-2.33/tcl/ex/simple.tcl 

若出現網路模擬動畫,即表示安裝成功。

備註:安裝過程中遇到的問題

即Nam和xgraph安裝出錯問題

 

解決方案:

到目錄:/opt/ns-allinone-2.34/nam-1.14下,

./configure

 make

make install

P: 編譯nam時出錯:can't find X includes
S: 安裝libXt-devel

P: 編譯nam時出錯:x11/xmu/winutil.h: No such file or directory
S: 安裝libXmu-devel(到軟件包管理中搜到這些包,安裝)

同樣對xgraph類似!

注:在此感謝http://space.baidu.com.cn/%C2%CC%B2%E8%B0%A1%CF%EB/blog/item/1c2588d716fef42e9a5027cb.html

http://wenku.baidu.com/view/3b755c0203d8ce2f006623f9.html


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