SVN搭建

作者: reistlin

来源: http://www.reistlin.com/blog/195

一,环境:

Debian Liunx(5.x / 6.x) + apache2(2.2.16)+ Subversion(1.6.12)

二,配置:

1,apt-get 安装 apache2, openssl(https) 和 svn

reistlin:~# apt-get install apache2 apache2-mpm-worker openssl subversion libapache2-svn

2,新建 svn 目录(/home/svn),配置目录所有者(www-data)以及权限

reistlin:~# mkdir /home/svn
reistlin:~# chown www-data:www-data -R /home/svn/
reistlin:~# chmod 770 -R /home/svn/

3,创建 svn 用户密码配置文件:/etc/apache2/dav_svn.passwd

reistlin:~# /usr/bin/htpasswd -c /etc/apache2/dav_svn.passwd admin
New password:
Re-type new password:
Adding password for user admin

密码文件默认加密方法:CRYPT encryption,密码文件格式:用户名:密码
基于安全考虑,建议加密方法使用 SHA encryption:htpasswd -s 用户名

reistlin:~# cat /etc/apache2/dav_svn.passwd
 
admin:{SHA}0DPiKuNIrrVmD8IUCuw1hQxNqZc=
reistlin:{SHA}QL0AFWMIX8NRZTKeof9cXsvbvu8=
test1:{SHA}qUqP5cyxm6YcTAhz05Hph5gvu9M=
test2:{SHA}Y2fEjdGT1W6nsLqtJbGUVeUp9e4=

4,创建 svn 目录权限配置文件:/etc/apache2/dav_svn.authz

reistlin:~# cat /etc/apache2/dav_svn.authz
 
[groups]
admin=admin,reistlin
guest=test1,test2
 
[reistlin:/]    # 版本库 reistlin 权限配置
*=              # 默认禁止所有用户访问
@admin=rw       # admin 组有 rw 权限
test1=r         # 用户 test1 有 r 权限

5,配置 /etc/apache2/mods-available/dav_svn.conf

reistlin:~# vim /etc/apache2/mods-available/dav_svn.conf

创建 svn location,指定 svn 目录,认证方式,认证信息;
指定 dav_svn.passwd 用户密码配置文件路径;
指定 dav_svn.authz 目录权限配置文件路径。

<Location /svn>
  DAV svn
  SVNParentPath /home/svn
  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/apache2/dav_svn.passwd
  AuthzSVNAccessFile /etc/apache2/dav_svn.authz
  Require valid-user
</Location>

6,创建 svn 版本库(reistlin)

reistlin:~# su - www-data
reistlin:~$ svnadmin create /home/svn/reistlin

7,配置完成,重新启动 apache2 服务

reistlin:~$ su - root
reistlin:~# /etc/init.d/apache2 restart

8,启动浏览器,访问 http://localhost/svn/reistlin

svn_http.gif

三,管理:

1,新建用户(htpasswd SHA 加密方法,参数:-s)

reistlin:~$ sudo /usr/bin/htpasswd -s /etc/apache2/dav_svn.passwd 用户名

2,删除用户(vi/vim 编辑)

reistlin:~$ sudo vim /etc/apache2/dav_svn.passwd

查找指定用户名:/用户名
删除用户指定行:dd
保存退出::wq

3,Subversion 客户端

[TortoiseSVN](开源软件:支持英文/简体中文/繁体中文)

四,相关信息:

Debian Linux Apache2 HTTPS/SSL + SVN 配置
[http://www.reistlin.com/blog/197]

五,centos搭建方法详见: http://www.ha97.com/4467.html

六,commit-email.pl

参考:

http://sdxiaxl.wap.blog.163.com/w2/blogDetail.do?blogId=660912064&hostID=sdxiaxl

http://qvb3d.iteye.com/blog/1488209

七,post-commit

#!/bin/sh
# Subversion post commit hook
REPOS="$1"
REV="$2"
PROJ=`basename $REPOS`
MAILLIST=`/SVN_DATA/mail-list.sh $REPOS $REV`
#For chinese charset
export LANG=zh_CN.UTF-8   #For Common Linux
export LC_ALL=zh_CN.UTF-8 #For Debian
/SVN_DATA/commit-email.pl $REPOS $REV --from "×××@×.com" --diff y -s "SVN: [$PROJ]" $MAILLIST
八,Debian svn mail list 支持,需要安装libauthen-sasl-perl,其他部分可以参照六、七
apt-get install libauthen-sasl-perl

commit-email.pl资源:

http://download.csdn.net/download/ying357/4995703


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值