VisualSVN Server+Trac集成安装

团队开发过程中,Subversion是首选的源码版本控制软件,Trac是基于网页界面的项目管理和缺陷最终的软件,最重要的是它们都是开源的。

    • Subversion在linux下配置较为繁琐,幸好Windows下有免费的VisualSVN Server可以使用,它简化了安装,提供简单的下一步安装方式。具体下载地址
    • Trac官方网站提供了下载,但要与VisualSVN Server集成,最好从VisualSVN网站上下载Trac软件。具体下载地址。安装说明是英文的。
    • 有朋友问到如何给用户加Admin权限,具体见文章底部。

    </ul> </div> 下面介绍一下VisualSVN Server+Trac集成安装具体步骤:

      1. 下载VisualSVN Server 2.6.4或以上版本。 VisualSVN Server+Trac集成安装(图文版)VisualSVN Server+Trac集成安装(图文版)
      2. 使用默认的设置安装,如果端口443冲突就换成8443,没有域服务器(一般都是对等网)的选择Subversion认证方式。
      3. 安装成功后,打开VisualSVN Server Manager,新建版本库,例如MyProject(这里改成你自己的项目名,记住下面所有的操作中只要有MyProject,都要替换成你自己的项目名) VisualSVN Server+Trac集成安装(图文版)VisualSVN Server+Trac集成安装(图文版)VisualSVN Server+Trac集成安装(图文版)
      4. 使用Subversion认证方式,至少要创建一个用户。 VisualSVN Server+Trac集成安装(图文版)
      5. 下载Trac,网址同上:trac+subversion集成安装包 VisualSVN Server+Trac集成安装(图文版)VisualSVN Server+Trac集成安装(图文版)VisualSVN Server+Trac集成安装(图文版)
      6. 解压到 %VISUALSVN_SERVER% 目录,一般为:C:\Program Files\VisualSVN Server VisualSVN Server+Trac集成安装(图文版)
      7. 创建C:\Trac目录(可更换为其它目录,但下面的C:\Trac都要替换成你自己的目录)
      8. C:\Trac目录的安全性设置:增加Network Service用户,权限为完全控制 VisualSVN Server+Trac集成安装(图文版)
      9. 打开命令行窗口(运行 cmd),执行:"%VISUALSVN_SERVER%trac\trac-admin.bat" C:\Trac\MyProject initenv 注意:如果你的项目名不是MyProject,目录不在C:\Trac,一定要替换成你自己的,下面的也类似,不再重复。 VisualSVN Server+Trac集成安装(图文版)VisualSVN Server+Trac集成安装(图文版)VisualSVN Server+Trac集成安装(图文版)
      10. 继续执行下面的命令,用来集成Trac项目与具体的Subversion项目连接。"%VISUALSVN_SERVER%trac\trac- admin.bat" c:\Trac\MyProject repository add MyProject C:\Repositories\MyProject svn VisualSVN Server+Trac集成安装(图文版)
      11. 非常关键,设置不对,在Trac里看不到用户对源码的修改版本。找到Subversion默认安装的版本库目录,一般为C:\Repositories\MyProject\hooks,新建一个post-commit.cmd文件,加入如下文字:"%VISUALSVN_SERVER%trac\trac-admin.bat" C:\Trac\MyProject changeset added "%1" "%2" VisualSVN Server+Trac集成安装(图文版) VisualSVN Server+Trac集成安装(图文版)
      12. 非常关键,在上一步的目录中,另外新建一个post-revision.cmd文件,加入如下文字:@"%VISUALSVN_SERVER%trac\trac-admin.bat" C:\Trac\MyProject changeset modified "%1" "%2" VisualSVN Server+Trac集成安装(图文版)
      13. 增加系统变量:PYTHONHOME=C:\Program Files\VisualSVN Server\trac\python,具体的和你安装目录一致即可。 VisualSVN Server+Trac集成安装(图文版)
      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

    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

    </span>VisualSVN Server+Trac集成安装(图文版) </li>

    • 如果是Windows集成认证,则加入:
      LoadModule python_module "trac/python/mod_python_so.pyd"
      LoadModule authz_user_module bin/mod_authz_user.so

     

    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
    </li>

    • 最好是重启电脑,因为环境变量要生效才可以,另外,VisualSVN Server也需要重启,所以直接重启电脑最好。以免出现500错误。 VisualSVN Server+Trac集成安装(图文版)VisualSVN Server+Trac集成安装(图文版)
    • 访问 https://localhost:443/trac/MyProject or https://localhost:8443/trac/MyProject VisualSVN Server+Trac集成安装(图文版)
    • 如果SVN服务器已经运行后才安装的Trac服务器,需要使用同步命令来更新Trac服务器的内容:"%VISUALSVN_SERVER%trac\trac-admin.bat" C:\Trac\MyProjects repository resync "*" VisualSVN Server+Trac集成安装(图文版)
    • 本文默认集成了svn的用户名和密码,所以Trac服务器不需要额外的用户名和密码,但如何把现有的svn用户名变成Trac服务器的超级用户呢?
      具体作法仍然是使用 trac-admin命令:"%VISUALSVN_SERVER%trac\trac-admin.bat" C:\Trac\MyProjects permission add admin TRAC_ADMIN

     

    </ol>

     本文由用户 jopen 自行上传分
    来源:https://www.open-open.com/lib/view/open1386169459048.html