免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1340 | 回复: 0
打印 上一主题 下一主题

DEBIAN下安装SVN [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-08-27 11:39 |只看该作者 |倒序浏览

1.安装
debian:/# aptitude install subversion subversion-tools apache2 libapache2-svn
2.创建一个新的subversion储存库:
debian:/# svnadmin create /lxq
在/lxq目录创建一个新的空储存库,数据储存方式默认采用Berkeley DB。
3.更改该目录的拥有者为网页读取
修改/data/subversion目录访问权限使它可被Apache进程访问,我的Apache是用www-data启动的,所以设置方法如下:
debian:/# chown -R www-data.www-data /data/subversion4.修改apache的svn设定文档:/etc/apache2/mods-available/dav_svn.conf
# dav_svn.conf - Example Subversion/Apache configuration
#
# For details and further options see the Apache user manual and
# the Subversion book.
#  ...
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as http://hostname/svn/
                                 #设置访问路径
  # Uncomment this to enable the repository,
   DAV svn                                      #启用
  # Set this to the path to your repository
   SVNPath /data/subversion                     #设置储存库路径,仅支持单个储存库,该路径要可被Apache进程访问。
  #SVNParentPath /data/subversion               #如果subversion下有多个储存库,则用SVNParentPath
  # The following allows for basic http authentication.  Basic authentication
  # should not be considered secure for any particularly rigorous definition of
  # secure.
  # to create a passwd file                     #按下面的步骤创建Apache用户验证文件
  # # rm -f /etc/apache2/dav_svn.passwd
  # # htpasswd2 -c /etc/apache2/dav_svn.passwd dwhedon
  # New password:
  # Re-type new password:
  # Adding password for user dwhedon
  # #
  # Uncomment the following 3 lines to enable Basic Authentication
   AuthType Basic                               #启用Apache基础验证
   AuthName "Subversion Repository"             #设置验证框标题
   AuthUserFile /etc/apache2/dav_svn.passwd     #指定验证用户文件名
  # Uncomment the following line to enable Authz Authentication
   AuthzSVNAccessFile /etc/apache2/dav_svn.authz  #启用目录级别授权,dav_svn.authz是授权配置文档
  # The following three lines allow anonymous read, but make
  # committers authenticate themselves.
  #    #允许匿名访问,不允许Commit,不能与AuthzSVNAccessFile同时使用
    Require valid-user                        
  #
5.设定使用人的权限:修改/etc/apache2/dev_svn.authz
  
   通过Apache的用户验证功能可以区别匿名用户和验证用户,从而赋予匿名用户读权限和验证用户读/写的权限。这些权限只能在全局范围内设置,不能设置具体的某个目录是否能被某个用户操作。要实现目录级别的  授权,就要使用mod_authz_svn.so模块提供的AuthzSVNAccessFile指令。它会指定一个授权文档,该授权文档设置具体的目录权限。根据上面的配置,授权文档名叫dav_svn.authz,它的内容如下:
[groups]              #定义组
admin=lxq,lxq007
tests=test1,test2
[erp:/]              #定义erp储存库根目录的访问权限
@admin=rw            #admin组有读写权限
tests=r              #test用户只有读权限
[oa:/test]           #定义oa储存库下test目录的访问权限
*=                   #禁止所有用户访问,星号代表所有用户,权限为空代表没有任何权限
lxq=rw           #打开ringkee用户的读写权限
6.增加apache连接进来的使用者帐号  /etc/apache2/dev_svn.passwd
debian:/# htpasswd -c /etc/apache2/dev_svn.passwd lxq
New password:
Re-type new password:
Adding password for user lxq
debian:/#htpasswd -c /etc/apache2/dev_svn.passwd test17.重启apache2
/etc/init.d/apache2 restart
8.导入你的源码:
debian:/# svn import /var/www/web1 file:///lxq/web1
               
               
                9.显示储存库内容:debian:/# svn list file:///lxq/web1
index.php
a.php
显示web1目录内容,成功导入。
上面我使用了file:///形式的URL来访问Subversion库,这表示在本地通过文件系统访问。但我们的Subversion库可能需要通过网络被其它用户访问,这就需要用到其它的协议,下表是Subversion支持的各种访问协议:
Table 9.1. 访问协议
协议
访问方法
file:///
通过本地磁盘访问。
http://
与Apache组合,通过WebDAV协议访问。
https://
同上,但支持SSL协议加密连接。
svn://
通过svnserve服务自定义的协议访问。
svn+ssh://
同上,但通过SSH协议加密连接。

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/73230/showart_1149879.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP