linux下svn的配置方法

 

1、yum install subversion  # 安装svn组件

 

安装成功之后,可以看到如下相关的命令被生成:

[flykobe@localhost svnclient]$ svn svn svnadmin svndumpfilter svnlook svnserve svnsync svnversion  

 

2、生成svn仓库

 

svnadmin create /var/svnrepos

 

[flykobe@localhost svnrepos]$ ls -R .: conf dav db format hooks locks README.txt ./conf: authz passwd svnserve.conf ./dav: ./db: current format fs-type revprops revs transactions uuid write-lock ./db/revprops: 0 ./db/revs: 0 ./db/transactions: ./hooks: post-commit.tmpl post-revprop-change.tmpl pre-commit.tmpl pre-revprop-change.tmpl start-commit.tmpl post-lock.tmpl post-unlock.tmpl pre-lock.tmpl pre-unlock.tmpl ./locks: db.lock db-logs.lock 

 

修改conf下的文件:

 

 

[general] ### These options control access to the repository for unauthenticated ### and authenticated users. Valid values are "write", "read", ### and "none". The sample settings below are the defaults. anon-access = read auth-access = write ### The password-db option controls the location of the password ### database file. Unless you specify a path starting with a /, ### the file's location is relative to the conf directory. ### Uncomment the line below to use the default password file. password-db = passwd ### The authz-db option controls the location of the authorization ### rules for path-based access control. Unless you specify a path ### starting with a /, the file's location is relative to the conf ### directory. If you don't specify an authz-db, no path-based access ### control is done. ### Uncomment the line below to use the default authorization file. authz-db = authz ### This option specifies the authentication realm of the repository. ### If two repositories have the same authentication realm, they should ### have the same password database, and vice versa. The default realm ### is repository's uuid. realm = My First Repository 

 

并利用htpasswd生成加密的账号:

[flykobe@localhost svnrepos]$  htpasswd -cm conf/passwd flykobe # c是create

 

3、这时就可以访问svn了:

[flykobe@localhost svnrepos]$ svn info file:///var/svnrepos/ 路径:svnrepos 地址(URL):file:///var/svnrepos Repository Root: file:///var/svnrepos 档案库 UUID:f561f977-8526-4757-94ed-60f16aaa3677 修订版:0 节点种类:目录 最后修改的修订版:0 最后修改的时间: 2009-12-29 17:17:02 +0800 (二, 29 12月 2009) 

 

4、将svn与apache关联起来

 

yum install mod_dav_svn # 安装svn的apache扩展,会在apache的module下生成mod_svn_dav.so

 

修改apache配置:

 

201 <Location /repos> 202 DAV svn 203 SVNPath /var/svnrepos/ 204 AuthType Basic 205 AuthName "Subversion repository" 206 AuthUserFile /var/svnrepos/conf/passwd 207 Require valid-user 208 </Location> 

 

重启apache,之后可以利用http访问svn了:

 

svn list http://127.0.0.1/repos

 

你可能感兴趣的:(linux下svn的配置方法)