SVN說明文檔java
1、SVN安裝(Apache+Subversion)apache
1、確認系統是否已經安裝 app
#yum install subversionide
2、安裝apache的svn模塊svn
#yum install mod_dav_svnui
3、建立subversion版本庫,並修改權限this
# mkdir /var/www/svnspa
#svnadmin create /var/www/svn/MusicXXrest
#chown –R apache.apache /var/www/svn/MusicXX orm
2、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
3、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 //若是在前面加上@符號,則表示這是個羣組權限設置