Monday, September 17, 2007

SVN & Trac Installation 備忘

上週一(9/10)公司要我把 Subversion 環境架起來。除了很高興公司也打算採行版本控制環境來幫助程式開發外,我還打算一併把 Issue Tracking 系統掛上去。

說起 Issue Tracking System,要跟 Subversion 搭配良好,且一樣是 freeware 的,當然非 Trac 莫屬。細查之下,乖乖, Trac 竟然要裝那麼多相關套件,且各個套件還要挑正確版本,才可運作良好。

為了避免大家(或將來的自己)白走冤枉路,這裡把要安裝的東西及安裝步驟條列於後:

Download

反正就把下列連結清單中的檔案都抓下來,待會再一口氣安裝。

Basic install

  1. Run the installer for the latest TortoiseSVN (e.g. TortoiseSVN-1.4.5.10425-win32-svn-1.4.5.msi)
  2. Run the installer for Apache 2.0.xx (e.g. apache_2.0.59-win32-x86-no_ssl.msi)
    • # 讓 SVN client 可以透過 http protocol 連上 SVN server
  3. Run the installer for the latest 1.4.x subversion server(e.g. svn-1.4.5-setup.exe
    • 順便把 D:\AppServ\Apache2\bin 加入系統變數 PATH 裡,以方便之後的操作

上面安裝順序只要 Apache2 先於 Subversion 即可,因為 Subversion 安裝程式會認得執行中的 Apache2 ,並自動完成一些設定,讓人省很多功夫。

如果只是個人使用,且不打算搭配 Trac ,那裝 TortoiseSVN 即可,而 Apache2 只有下列情形下才需要安裝:

  • 想走 http:// 協定來執行 import, check out, commit, export... 等操作,不想走 Subversion 內定的 svn:// 協定。
  • 想要有 MD5 加密的使用者通行口令認證。
  • 想要 Apache2 代為管理讀取權限。
  • 想要搭配 Trac 使用。

Install SVN Python-packages for Trac

  1. Run the installer for the latest Python 2.4.x (e.g. python-2.4.4.msi)
  2. Run ez_setup.py
    • # 會自動下載 setuptools.exe, 透過此工具以簡化後續的安裝步驟
  3. 開 DOS 窗,切到 Python24\Scripts ,待會的 ezsay_install 都在這執行
  4. Install Python bindings for Subversion
    easy_install -Z http://subversion.tigris.org/downloads/1.4.5-win32/apache-2.0/svn-python-1.4.5.win32-py2.4.exe
    • # 安裝成功會出現 "Finished processing dependencies for svn-python==1.4.2"; 這個步驟需要一段明顯的等待
    • # 讓我們透過 Python 操控 SVN
  5. Install ClearSilver
    easy_install -f http://clearsilver.net/downloads clearsilver==0.9.14
    • # 樣板引擎
  6. Install the latest PySQLite
    easy_install pysqlite
    • # 讓我們透過 Python 操控 Sqlite
  7. Run the installer for SilverCity (SilverCity-0.9.7.win32-py2.4.exe)
    • # 程式碼上色

以上只要 Python24 先安裝即可。

Install Trac

  1. Run the installer for Mod_python (mod_python-3.2.10.win32-py2.4-apache2.0.exe)
    • # An Apache module that embeds the Python interpreter within the server (for Apache/Python Integration)
    • # 用於整合Trac 和 Apache Web Server
  2. Run the installer for Trac 0.10.4 (trac-0.10.4.win32.exe)
    • 把 trac-admin 和 tracd 少掉的副檔名(.py)給加上去:
      cd Python24\Scripts
      ren trac-admin trac-admin.py
      ren tracd tracd.py
      • # 如此,以後在命令列執行時可以直接執行(e.g. tracd.py),不用多打 python (e.g. python tracd)
      • # An enhanced wiki and issue tracking system for software development projects
  3. Install optional Trac plugins
    • Install AccountManagerPlugin (for Trac 0.10.x)
      easy_install http://trac-hacks.swapoff.org/svn/accountmanagerplugin/0.10
      • # 若安裝失敗,則直接對 .egg 執行 easy_install 例如
        easy_install D:\Python24\lib\site-packages\tracaccountmanager-0.1.3dev_r2548-py2.4.egg
      • # 來管理 Trac 專案的成員帳號

WebAdmin, AcdountManager, iniAdmin 這三個 Trac plugins ,可以讓我們直接在 Browser 上操作 Trac 設定,減少於命令列下指令的必要,強烈建議安裝。

如果還有其他需求的,可以到 Trac Hacks 看看有沒有人提供現成的。

此外,有 Trac 中文化需求的,可以到下列網站上逛逛:

Module Loadings of Apache2

首先要先以文字編輯器開啟 Apache2\conf\httpd.conf ,然後搜尋到

#LoadModule dav_module modules/mod_dav.so

將上面的註解 ( # 字號) 去除(如果依照上述的步驟安裝,註解應該被安裝程式拿掉了)。

然後在整個 LoadModule 區段的下方加入以下設定:

# For Subversion
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

# For Trac
LoadModule python_module modules/mod_python.so

這樣 Apache 重新啟動時,就會載入 DAV, SVN 和 Python 等模組。

Tags: [] []

7 comments:

Jiang Junyu said...

Trac比較麻煩只能單一Project使用吧?

Anonymous said...

可以考慮使用Codebeamer, Codebeamer內含Issue tracking, Wiki, document management, SVN/CVS connection , 而且對於SVN有support repository管理功能, 安裝也非常簡單, 有support multi-project, 可以到http://www.esast.com申請free test version

York said...

To Double Chiang

Trac 的確只能單一 Project 使用,雖然可以建很多 Project ,但每個 Project 的設定都是獨立的,管理上的確有點小麻煩。

York said...

先前 IniAdmin 及 AccountManager 這兩個 plugins 用 easy_install 成功安裝後,其對應的 Web UI 一直沒出現。

後來才發現是因為同一種 plugins 的多個 .EGG 安裝後會互相衝突,解法也很直接,就是到 Python24\Lib\site-packages 下刪除多餘的 .EGG 即可。

York said...

若多個 Trac repositoris 間有一些 trac.ini 設定是相同的,可以把大家都一致的 ini 另建一個 trac.ini ,然到 Python24\share\trac 下建個 conf 目錄,將剛剛建立的 trac.ini 丟過去。

如此,個別的 trac.ini 就會自動變得比較短小。

York said...

TracHacks上真的很多寶可以挖,這陣子試用了裡面的 Trac logout patch, tag plugin, blog plugin, theme plugins 等,都不錯用。

這幾天想繼續挖些寶來玩玩竟然都連不進去,有人知道那怎麼了嗎?太多人連了?

York said...

前幾天忙裡偷閒,升級到 TortoiseSVN 1.4.7 , Apache 2.0.61 及 Subversion 1.4.6 了。

TortoiseSVN 及 Apache 都只執行 installer 就行了。

Subversion 1.4.6 沒有 installer ,只有 zip 包,解壓縮後拉一份到先前安裝的目錄就行了。然後把其 python binder 的 installer 跑一跑就大功告成了。