話說 Debian 3.0 Sarge 的版本現在不易弄到(現在看居然有些是要用買才能拿到 = =")~自己能找出兩年前抓的 Sarge DVD安裝片也真是慶幸的大叫..爽啊!

從遭遇找不到光碟片,到尋獲的過程中,真的百感交替~所以決定若有朋友需要 Sarge  DVD dis1 , 2 可留言或 e-mail 給紅,再告知如何下載

以下為安裝NS2.27 在 Debian Sarge 的過程

OS: Debian3.0r0 (代號:Sarge)

User: ns2

NS2 : NS2 2.27

安裝好 Debian 3.0rX 之後,先切換至 root 補齊以下的套件

注意,不能升級至 GCC 4.x 的版本,要使用 gcc 3.4 才行,不然編譯時即會產生錯誤

#aptitude

以下需求的套件是從其他網頁上得來的資料,經紅安裝後也的確可以運作..

gcc-3.4

gcc-3.4-base

g++-3.4

xgraph

xlibs-static-dev

gnome-core(已預設安裝)

x-window-system-core(已預設安裝)

http://www.isi.edu/nsnam/dist/ 下載 NS2 v2.27(檔名:http://www.isi.edu/nsnam/dist/ns-allinone-2.27.tar.gz 此為套件整合包)至個人帳號目錄下

2.將檔案解壓縮後,即會建立目錄『ns-allinone-2.27』

#tar -zxvf ns-allinone-2.27.tar.gz

---------如果安裝 Debian 3.0 (Sarge)就跳過此段----------

===========Fedora Core 5 and Suse 10 適用=================

若使用 Fedora Core 5 and Suse 10 進行直接編譯應該會產生以下的錯誤訊息,要進行 patch 修正

(紅曾用 Fedora 5 進行 patch 及安裝,卻仍是失敗…Orz ,於是放棄~很慶幸的翻出兩年前的 Debian 3.0r (Sarge) 才有此篇的產生)

測試過後發現 2.27,2.28 ,2.29.2無法直接編譯,會有下列的錯誤訊息:

checking if 64bit support is requested… no
checking if 64bit Sparc VIS support is requested… no
checking system version (for dynamic loading)… ./configure: line
7624: syntax error near unexpected token `)’
./configure: line 7624: ` OSF*)’
tcl8.3.2 configuration failed! Exiting …
Tcl is not part of the ns project. Please see
http://www.Scriptics.com<;http://www.scriptics.com/>
使用 http://www.tekno.chalmers.se/~yusheng/projects.htm 網頁的 2.26,2.27,2.28 patch 及執行方式後,即可編譯

若以 2.27 版的 patch for gcc 4.1(檔名:ns-2.27-gcc410.patch)為例:

在 ns-allinone-2.27 目錄外,下指令:

#patch -p0 <ns-2.27-gcc410.patch

=============================================2007.11.08 update=

---------接續以下動作----------

接下來開始編譯

#cd ns-allinone-2.27

#./install

編譯成功後,會出現訊息,需要使用者手動設定ns2路徑至個人 PATH 中

ns2_01_.gif

=================================================================

.———————————————————————————-

Please put /home/ns2/ns-allinone-2.27/bin:/home/ns2/ns-allinone-2.27/tcl8.4.5/unix:/home/ns2/ns-allinone-2.27/tk8.4.5/unix
into your PATH environment; so that you’ll be able to run itm/tclsh/wish/xgraph.

IMPORTANT NOTICES:

(1) You MUST put /home/ns2/ns-allinone-2.27/otcl-1.8, /home/ns2/ns-allinone-2.27/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/ns2/ns-allinone-2.27/tcl8.4.5/library into your TCL_LIBRARY environmental
variable. Otherwise ns/nam will complain during startup.

(3) [OPTIONAL] To save disk space, you can now delete directories tcl8.4.5
and tk8.4.5. They are now installed under /home/ns2/ns-allinone-2.27/{bin,include,lib}

After these steps, you can now run the ns validation suite with
cd ns-2.27; ./validate

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

==============================================================================

在(1)的路徑設定上, Debian 預設是使用 bash,所以要用 LD_LIBRARY_PATH

3.設定 NS2 環境路徑

#nano ../.bashrc

將下述三行加至 .bashrc 中,即可

第一行多加了 $PATH 是加原有系統設定的路徑一併加回,若未加的話,就無法系統中可執行的程式了

另~每個路徑結束後,使用冒號—>’ : ‘ 做分隔

export PATH=$PATH:/home/ns2/ns-allinone-2.27/bin:/home/ns2/ns-allinone-2.27/tcl8.4.5/unix:/home/ns2/ns-allinone-2.27/tk8.4.5/unix
export LD_LIBRARY_PATH=/home/ns2/ns-allinone-2.27/otcl-1.8:/home/ns2/ns-allinone-2.27/lib
export TCL_LIBRARY=/home/ns2/ns-allinone-2.27/tcl8.4.5/library

4.重新登入帳號 ns2 (讓系統重新讀取一次PATH路徑)

5.讓NS2進行驗證動作

#cd ns-allinone-2.27

#cd ns-2.27

#./validate

約半小時至數小時後,就可以看一行字出現:

 All test pass

ns2_02_.gif

恭喜!成功了….

(編譯成功時的字當然不會放大!加粗!,但~~~是我太激動…我~~~終於在 Debian 上可以正常使用NS2 了…泣)

附記:

在 Linux KDE 或 GNOME 桌面環境下執行 NS-2 (沒有 Cygwin 模擬 lnux 環境的指令: startxwin.bat 去啟動繪圖模式)只要直接下指令(以執行example2.tcl為例)

#ns example2.tcl

就可以了(若tcl 中有要求圖形畫面的輸出)

NS2_snapshot.jpg

參考網頁

1.Downloading and installing ns-2

2.Kcw’s Blog – Debian GNU Linux / 安裝NS2

3.ns2 – main page

後記:

1.很感謝 Kcw 寫的Debian相關套件資料,讓紅在安裝過程上節省不少資料搜尋的時間。


相關文章:

[Wedding] 幸福旅程 – 孝慶 & 可馨《迎取》
[Wedding] 幸福旅程 – 孝慶 & 可馨《迎取》

[婚禮紀錄] 2008.12.27 建文 & 美燕婚禮(圖多)
[婚禮紀錄] 2008.12.27 建文 & 美燕婚禮(圖多)

回家
回家

YAMAHA Nouvo
YAMAHA Nouvo

RuRu@中原大學
RuRu@中原大學

580EX II
580EX II

Tags: ,