svn就这么简单1——安装与配置


svn就这么简单1——安装与配置
 
一,Subversion有两种运行方式
一种是基于Apache Http Server,另外一种是Subversion Standalone Server ,见linux svn安装和配置,不结合apache。
 
以下是基于httpd的svn的安装
 
二,安装svn
[plain] 
yum install -y httpd httpd-devel subversion mod_dav_svn  
如果你已经装了apache了,不想装二个apache的话。你可以单独下个subversion来装一下就行了。
 
注意一点的是,路径要正确:
 
[plain] 
./configure --with-apxs=/apache路径/bin/apxs --prefix=/usr/local/subversion  
--with-apr=/usr/local/apache2 --with-apr-util=/apache路径 --with-ssl --with-zlib  
--enable-maintainer-mode  
 
 
1),确定已经安装了svn模块:mod_dav_svn
 
[plain] 
# cd /etc/httpd/modules/  
# ls |grep svn  
mod_authz_svn.so  
mod_dav_svn.so  
 
2),看一下svn是否已安装成功
 
 
 
[plain] 
# svn --version  
  
  
svn, version 1.4.2 (r22196)  
compiled Aug 10 2009, 18:00:04  
  
Copyright (C) 2000-2006 CollabNet.  
Subversion is open source software, see http://subversion.tigris.org/  
This product includes software developed by CollabNet (http://www.Collab.Net/).  
  
The following repository access (RA) modules are available:  
  
* ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.  
- handles 'http' scheme  
- handles 'https' scheme  
* ra_svn : Module for accessing a repository using the svn network protocol.  
- handles 'svn' scheme  
* ra_local : Module for accessing a repository on local disk.  
- handles 'file' scheme  
 
三,创建仓库,修改svn配置文件
1),创建仓库,以及仓库目录的设置
 
 
[plain] 
# mkdir -p /var/www/svn  
  
# cd /var/www/svn  
  
# svnadmin create test  
  
# chown -R apache.apache svn  
 
 
2),编辑svn的配置文件
 
[plain] 
#vi /etc/httpd/conf.d/subversion.conf  
 
如下:
 
[plain] 
LoadModule dav_svn_module     modules/mod_dav_svn.so  
LoadModule authz_svn_module   modules/mod_authz_svn.so  
  
  
<Location /svn>  
   DAV svn  
  
   SVNParentPath /var/www/svn  
#  
#   # Limit write permission to list of valid users.  
#   <LimitExcept GET PROPFIND OPTIONS REPORT>  
#      # Require SSL connection for password protection.  
#      # SSLRequireSSL  
#  
   AuthType Basic  
   AuthName "Subversion repository"  
   AuthzSVNAccessFile /var/www/svn/authz.conf  
   AuthUserFile /var/www/svn/user.passwd  
   Require valid-user  
#   </LimitExcept>  
</Location>  
 
 如果只有一个仓库的话,那么把参数SVNParentPath 换成 SVNPath,不过最好不要这样啦,谁也不确定以后会用到几个仓库,而SVNParentPath可以包括多个仓库,指定的路径则是所有仓库的父目录。
 
 
3),添加用户
 
下面建立可访问用户文件
 
[plain] 
# htpasswd -bc /var/www/svn/user.passwd 用户名 密码  
 
要增加用户,则使用下面命令
 
[plain] 
# htpasswd -b /var/www/svn/user.passwd 用户名 密码  
4),权限分限
 
[plain] 
# vi /var/www/svn/authz.conf  
 
内容如下:
[plain] 
[test:/]                      //这表示,仓库test的根目录下的访问权限  
jason =  rw          //test仓库zhangy用户具有读和写权限  
peterson = r                 //test仓库hunk用户具有读权限  
[/]                             //这个表示在所有仓库的根目录下  
* = r                        //这个表示对所有的用户都具有读权限  
#[groups]             //这个表示群组设置  
#svn1-developers = jason,peterson             //这个表示某群组里的成员  
#svn2-developers = jason,kevin  
#[svn1:/]  
#@svn1-developers = rw                            //如果在前面加上@符号,则表示这是个群组权限设置  
 
 
上面弄好了之后,重启一下apache就行了
[plain] 
#service httpd restart  
 
然后访问http://your_ip/svn/test
输入用户名和密码,就可以进入svn的test库里面了,现在进去是空的,里面没有什么内容的,稍后提交新的内容就可以通过这个url看到了。
 

相关内容

    暂无相关文章