Chinaunix首页 | 论坛 | 博客
  • 博客访问: 130085
  • 博文数量: 32
  • 博客积分: 115
  • 博客等级: 民兵
  • 技术积分: 290
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-30 23:19
个人简介

The minute you think of giving up, think of the reason why you held on so long!

文章分类

全部博文(32)

文章存档

2018年(4)

2016年(8)

2015年(2)

2014年(11)

2013年(6)

2012年(1)

我的朋友

分类: LINUX

2014-05-21 11:53:00

给自己部门配置个svn服务器用,找了很多帖子,各种缺少,所以把自己配置的全部过程记录下,留用加分享下

系统、软件列表:

Centos5.6.x84_64(系统自带了Subversion1.6,如果不卸载掉的话,需要用全路径执行安装的svn命令【卸载命令yum erase svn】)
Subversion-1.7.16.tar.gz
httpd.2.2.3-85.el5.x86_64.rpm

安装支持包:
# yum install openssl.x86_64 openssl-devel.x86_64
# yum apr.x86_64 apr-devel.x86_64 apr-util.x86_64 apr-util-devel.x86_64

安装Apache:
# yum install httpd.x86_64 httpd-devel.x86_64
# /etc/init.d/httpd start
通过浏览器访问 访问到apache的欢迎页面,说明apache安装正常

安装Subversion:
# tar zxf subversion-1.7.16.tar.gz
# cd subversion-1.7.16
# ./get-deps.sh(安装sqlite、neon)
# ./configure --prefix=/opt/svn/ --with-apxs=/usr/sbin/apxs --with-apr=/usr/bin/apr-1-config --with-apr-util=/usr/bin/apu-1-config
# make && make install
# /opt/svn/bin/svnversion --version(查看版本,确认安装)
svnversion, version 1.7.16 (r1569520)
   compiled May 19 2014, 18:02:11

Copyright (C) 2014 The Apache Software Foundation.
This software consists of contributions made by many people; see the NOTICE
file for more information.
Subversion is open source software, see
# ls /etc/httpd/modules/(查看svn的apache模块是否正确安装)
mod_authz_svn.so    mod_dav_svn.so

创建SVN版本库:
# mkdir /data/svnroot
# /opt/svn/bin/svnadmin create /data/svnroot/project1
# ls /data/svnroot/project1/
conf  db  format  hooks  locks  README.txt(出现这些文件,说明版本库创建成功)
# chown -R apache:apache /data/svnroot/
(给apache用户访问权限,否则会造成403权限错误)

配置Apache支持Subversion:
# vim /etc/httpd/conf/httpd.conf
#########SVN##########
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so


DAV svn
#SVNPath /data/svnroot/project1(SVNPath只能指定具体项目路径)
SVNParentPath /data/svnroot/(SVNParentPath指定SVN项目的上级目录路径)
SVNListParentPath on(开启父目录的列表显示)
AuthType Basic
AuthName "Lugood SVN"
AuthUserFile /data/svnroot/svn-user(通过apache进行的svn的用户认证文件)
AuthzSVNAccessFile /data/svnroot/svn-authz(通过apache进行的svn的用户权限管理文件)
Require valid-user(开启对所有访问用户进行认证)


# /etc/init.d/httpd restart
# htpasswd -c /data/svnroot/svn-user admin(参数-c是创建文件,只需要在第一次创建认证文件的时候使用)
New password:
Re-type new password:
Adding password for user admin
# htpasswd /data/svnroot/svn-user test1
New password:
Re-type new password:
Adding password for user test1
# vim /data/svnroot/svn-authz
[groups]
admin = admin,jalen

[/]
@admin = rw
* = r

[project1:/]
@admin = rw
test1 = r

启动svnserver:
# /opt/svn/bin/svnserve -d -r /data/svnroot/
至此,apache和subversion整合完成。

在windows上安装小乌龟TortoiseSVN客户端,就可以正常访问svn服务器了。
访问方式:

备注:
在apache的日志里边出现错误:
[error] [client 172.17.0.127] Could not fetch resource information.  [301, #0]

[error] [client 172.17.0.127] (11)Resource temporarily unavailable: Requests for a collection must have a trailing slash on the URI.  [301, #0]
这个错误是在客户端访问svn的时候,输入的访问路径最后少了"/"


阅读(1401) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~