负载平衡(2)–CentOS 5 之 SVN

其实SVN环境和负载平衡没有什么关系,只是team开发环境的一个准备

  1. 安装SVN

    # yum install subversion

  2. 建立Repos

    # mkdir -p /home/svn/repos/battlegame
    #svnadmin create /home/svn/repos/battlegame

  3. 建立trunk,braches,tags

    #svn mkdir file://localhost/home/svn/repos/battlegame/trunk -m “create”
    #svn mkdir file://localhost/home/svn/repos/battlegame/branches -m “create”
    #svn mkdir file://localhost/home/svn/repos/battlegame/tags -m “create”

  4. 安装mod_dav_svn

    #yum install mod_dav_svn

  5. 设定mod_dav_svn,修改 /etc/httpd/conf.d/subversion.conf

    LoadModule dav_svn_module     modules/mod_dav_svn.so
    LoadModule authz_svn_module   modules/mod_authz_svn.so

    <Location /svn>
    DAV svn
    # SVNPath /home/svn/repos/battlegame
    # any “/svn/foo” URL will map to a repository /var/svn/foo
    SVNParentPath /home/svn/repos
    # our access control policy
    AuthzSVNAccessFile /home/svn/repos/authzsvn.conf

    # only authenticated users may access the repository
    Require valid-user

    # how to authenticate a user
    AuthType Basic
    AuthName “Subversion repository(sample)”
    AuthUserFile /home/svn/repos/.htpasswd
    </Location>

  6. 设定apache认证,新建.htpasswd文件,输入用户名和密码。网上可以搜索到很多帮你设定密码的网站,比如http://www.luft.co.jp/cgi/htpasswd.php。最后文件如

    admin:xF4v98bL1ZGos

  7. 设定svn认证,新建authzsvn.conf,内容如

    [groups]
    #開発者
    developers = rex
    #管理者
    manager = admin
    #[/]
    #すべての人が読み込み可能
    #* = r
    [battlegame:/trunk]
    #開発者は読み書き可能
    @developers = rw
    [battlegame:/branches]
    #管理者は書き込みも可能
    @manager = rw
    [battlegame:/tags]
    #管理者は書き込みも可能
    @manager = rw

  8. 将/home/svn/repos/battlegame的权限设为775

    #chmod 775 -R /home/svn/repos/battlegame

  9. 将/home/svn/repos/battlegame的权限设为Apache可读
  10. #chown -R apache:apache /home/svn/repos/battlegame
  11. OK,重启Apache,在客户端CheckOut就可以了