VisualSVN Server+Trac集成安裝(圖文版)

 團隊開發過程當中,Subversion是首選的源碼版本控制軟件,Trac是基於網頁界面的項目管理和缺陷最終的軟件,最重要的是它們都是開源的。   

  • Subversion在linux下配置較爲繁瑣,幸虧Windows下有免費的VisualSVN Server可使用,它簡化了安裝,提供簡單的下一步安裝方式。具體下載地址    
  • Trac官方網站提供了下載,但要與VisualSVN Server集成,最好從VisualSVN網站上下載Trac軟件。具體下載地址。安裝說明是英文的。
  • 有朋友問到如何給用戶加Admin權限,具體見文章底部。
下面介紹一下VisualSVN Server+Trac集成安裝具體步驟:
  1. 下載VisualSVN Server 2.6.4或以上版本。 12
  2. 使用默認的設置安裝,若是端口443衝突就換成8443,沒有域服務器(通常都是對等網)的選擇Subversion認證方式。
  3. 安裝成功後,打開VisualSVN Server Manager,新建版本庫,例如MyProject(這裏改爲你本身的項目名,記住下面全部的操做中只要有MyProject,都要替換成你本身的項目名) 678
  4. 使用Subversion認證方式,至少要建立一個用戶。 9
  5. 下載Trac,網址同上:trac+subversion集成安裝包 345
  6. 解壓到 %VISUALSVN_SERVER% 目錄,通常爲:C:\Program Files\VisualSVN Server 10
  7. 建立C:\Trac目錄(可更換爲其它目錄,但下面的C:\Trac都要替換成你本身的目錄)
  8. C:\Trac目錄的安全性設置:增長Network Service用戶,權限爲徹底控制 11
  9. 打開命令行窗口(運行 cmd),執行:"%VISUALSVN_SERVER%trac\trac-admin.bat" C:\Trac\MyProject initenv 注意:若是你的項目名不是MyProject,目錄不在C:\Trac,必定要替換成你本身的,下面的也相似,再也不重複。 121314
  10. 繼續執行下面的命令,用來集成Trac項目與具體的Subversion項目鏈接。"%VISUALSVN_SERVER%trac\trac-admin.bat" c:\Trac\MyProject repository add MyProject C:\Repositories\MyProject svn 15
  11. 很是關鍵,設置不對,在Trac裏看不到用戶對源碼的修改版本。找到Subversion默認安裝的版本庫目錄,通常爲C:\Repositories\MyProject\hooks,新建一個post-commit.cmd文件,加入以下文字:"%VISUALSVN_SERVER%trac\trac-admin.bat" C:\Trac\MyProject changeset added "%1" "%2" 16 17
  12. 很是關鍵,在上一步的目錄中,另外新建一個post-revision.cmd文件,加入以下文字:@"%VISUALSVN_SERVER%trac\trac-admin.bat" C:\Trac\MyProject changeset modified "%1" "%2" 18
  13. 增長系統變量:PYTHONHOME=C:\Program Files\VisualSVN Server\trac\python,具體的和你安裝目錄一致便可。 19
  14. 找到%VISUALSVN_SERVER%conf\httpd-custom.conf文件(C:\Program Files\VisualSVN Server\conf\),若是使用的是Subversion認證方式(就是默認方式),在文件中加入:
    LoadModule python_module "trac/python/mod_python_so.pyd"
    LoadModule authz_user_module bin/mod_authz_user.so
    <Location /trac>
     SetHandler mod_python
     PythonInterpreter main_interpreter
     PythonHandler trac.web.modpython_frontend
     PythonOption TracEnvParentDir C:\Trac
     PythonOption TracUriRoot /trac

     AuthName "Trac"
     AuthType Basic
     AuthBasicProvider file
     AuthUserFile "C:/Repositories/htpasswd"
     
     Require valid-user
    </Location>
    20
  15. 若是是Windows集成認證,則加入:
    LoadModule python_module "trac/python/mod_python_so.pyd"
    LoadModule authz_user_module bin/mod_authz_user.so
    <Location /trac>
     SetHandler mod_python
     PythonInterpreter main_interpreter
     PythonHandler trac.web.modpython_frontend
     PythonOption TracEnvParentDir C:\Trac
     PythonOption TracUriRoot /trac

     AuthName "Trac"
     AuthType VisualSVN

     # Set the option's value to on if Windows Basic Authentication
     # is enabled, otherwise set it to off.
     AuthnVisualSVNBasic on
     # Set the option's value to on if Windows Integrated Authentication
     # (available in the Enterprise Edition) is enabled, otherwise set it to off.  AuthnVisualSVNIntegrated on

     Require valid-user
    </Location>
  16. 最好是重啓電腦,由於環境變量要生效才能夠,另外,VisualSVN Server也須要重啓,因此直接重啓電腦最好。以避免出現500錯誤。 2122
  17. 訪問 https://localhost:443/trac/MyProject or https://localhost:8443/trac/MyProject 23
  18. 若是SVN服務器已經運行後才安裝的Trac服務器,須要使用同步命令來更新Trac服務器的內容:"%VISUALSVN_SERVER%trac\trac-admin.bat" C:\Trac\MyProjects repository resync "*" 24
  19. 本文默認集成了svn的用戶名和密碼,因此Trac服務器不須要額外的用戶名和密碼,但如何把現有的svn用戶名變成Trac服務器的超級用戶呢?
    具體做法仍然是使用 trac-admin命令:"%VISUALSVN_SERVER%trac\trac-admin.bat" C:\Trac\MyProjects permission add admin TRAC_ADMIN
相關文章
相關標籤/搜索