CentOS SVN说明文档
时间:2010-09-13 来源:yrsjy
SVN说明文档
一、SVN安装(Apache+Subversion)
1、确认系统是否已经安装
#yum install subversion
2、安装apache的svn模块
#yum install mod_dav_svn
3、创建subversion版本库,并修改权限
# mkdir /var/www/svn
#svnadmin create /var/www/svn/MusicXX
#chown –R apache.apache /var/www/svn/MusicXX
二、SVN配制
1、设置apache的svn配置文件
#vi /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
#
# Example configuration to enable HTTP access for a directory
# containing Subversion repositories, "/var/www/svn". Each repository
# must be readable and writable by the 'apache' user. Note that if
# SELinux is enabled, the repositories must be labelled with a context
# which httpd can write to; this will happen by default for
# directories created in /var/www. Use "restorecon -R /var/www/svn"
# to label the repositories if upgrading from a previous release.
#
#
# To create a new repository "http://localhost/repos/stuff" using
# this configuration, run as root:
#
# # cd /var/www/svn
# # svnadmin create stuff
# # chown -R apache.apache stuff
#
<Location /repos>
DAV svn
SVNParentPath /var/www/svn
# our access control policy
AuthzSVNAccessFile /var/www/svn/svn_authz
#
# # Limit write permission to list of valid users.
# <LimitExcept GET PROPFIND OPTIONS REPORT>
# # Require SSL connection for password protection.
# # SSLRequireSSL
#
AuthType Basic
AuthName "Authorization Realm"
# AuthUserFile /path/to/passwdfile
AuthUserFile /var/www/svn/svn_auth_passwd
Require valid-user
# </LimitExcept>
</Location>
其中:
/var/www/svn/svn_auth_passwd为授权用户的密码文件
/var/www/svn/svn_authz为访问控制文件
建立授权用户的密码文件(密码MD5)
#htpasswd –cmb /var/www/svn/svn_auth_passwd 用户名 密码
第一次建立文件后,再次添加新用户时,去除命令选项-c
# htpasswd –mb /var/www/svn/svn_auth_passwd 用户名 密码
删除用户,用-D选项
htpasswd –D /var/www/svn/svn_auth_passwd 用户名
svn_authz为访问控制文件,格式如下:
[groups]
flash-developers = ruiwang,honghaiwang,
design-developers = beiyizeng,haibinhao
java-developers = yueboqin,zhaowenzhu,weidonglu
all-r = jindazhang
all-rw = tianhuliu,xiaojunge,xiaojun
[/]
@all-r = r
@all-rw = rw
[/Design]
@design-developers = rw
[/Flash]
@flash-developers = rw
[/FunClub]
@java-developers = rw
[/Manager]
@java-developers = rw
[/PageDesign]
@design-developers = rw
[/PersonSite]
@java-developers = rw
[/ShoppingMall]
@java-developers = rw
[/pmtPro]
@java-developers = rw
[/FlashData]
@java-developers = rw
[/MusicBox]
@java-developers = rw
[/Bonus]
@java-developers = rw
三、SVN管理
1、权限的管理
#/var/www/svn/svn_authz
[test:/] //这表示,仓库test的根目录下的访问权限
wooin = rw //test仓库wooin用户具有读和写权限
bao = r //test仓库bao用户具有读权限
[test2:/] //test2仓库根目录下的访问权限
wooin = r //wooin用户在test2仓库根目录下只有读权限
bao = //bao用户在 test2仓库根目录下无任何权限
[/] //这个表示在所有仓库的根目录下
* = r //这个表示对所有的用户都具有读权限
#[groups] //这个表示群组设置
#svn1-developers = wooin, bao //这个表示某群组里的成员
#svn2-developers = wooin
#[svn1:/]
#@svn1-developers = rw //如果在前面加上@符号,则表示这是个群组权限设置