版本:Centos6.6_64
环境:apache已安装
yum install mod_dav_svn subversion
安装完成后一般会出现配置文件如果没有出现的话也可以自己创建
修改或者创建 Subversion config file /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn> (apache下的位置)
DAV svn
SVNPath /home/svn/myproject (指明资源库的路径)
SVNParentPath /home/svn (如果有多个库,使用该选项)
SVNListParentPath on (打开这个选项可以列出ParentPath下面的所有库)
AuthType Basic (认证类型为基本认证 )
AuthName "Subversion Repository" (认证名称,将在IE界面弹出一个对话框,其标题)
AuthUserFile /etc/apache2/dav_svn.passwd (认证密码文件)
# AuthzSVNAcessFile /etc/apache2/dav_svn.authz (目录权限文件)
Require valid-user (要求验证用户,即不能匿名访问)
</Location>
apprepo example:
[root@AY140624153909325b49Z ~]# cat /etc/httpd/conf.d/subversion.conf
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
AuthType Basic
AuthName "Subversion repositories"
AuthUserFile /etc/svn-auth-users 账户和密码
AuthzSVNAccessFile /etc/svn-access-control 用户权限控制
Require valid-user
</Location>
[root@AY140624153909325b49Z ~]#
创建库访问用户:
## Create testuser ##
首次创建需要加 -c 参数
htpasswd - cm /etc/svn-auth-users testuser
New password :
Re - type new password :
Adding password for user testuser
## Create testuser2 ##
htpasswd - m /etc/svn-auth-users testuser2
New password :
Re - type new password :
Adding password for user testuser2
====================================================================
Create and configure SVN repository
mkdir /var/www/svn
cd /var/www/svn
svnadmin create testrepo
chown - R apache .apache testrepo
创建完成后:
[admin@localhost myapp]$ ll
总用量 28
drwxr-xr-x. 2 apache apache 4096 7月 30 15:10 conf
drwxr-xr-x. 3 apache apache 4096 7月 30 15:29 dav
drwxr-sr-x. 6 apache apache 4096 7月 30 15:47 db
-r--r--r--. 1 apache apache 2 7月 30 15:10 format
drwxr-xr-x. 2 apache apache 4096 7月 30 15:10 hooks
drwxr-xr-x. 2 apache apache 4096 7月 30 15:10 locks
-rw-r--r--. 1 apache apache 229 7月 30 15:10 README.txt
[admin@localhost myapp]$
cd conf/
[admin@localhost conf]$ ll
总用量 12
-rw-r--r--. 1 apache apache 1080 7月 30 15:10 authz
-rw-r--r--. 1 apache apache 309 7月 30 15:10 passwd
-rw-r--r--. 1 apache apache 2279 7月 30 15:10 svnserve.conf
[admin@localhost conf]$
如果防火墙在开启状态,那么就要修改CONTEXT值。
## If you have SELinux enabled (you can check it with "sestatus" command) ##
## then change SELinux security context with chcon command ##
chcon - R - t httpd_sys_content_t /var/www/svn/testrepo
## Following enables commits over http ##
chcon - R - t httpd_sys_rw_content_t/var/www/svn/testrepo
重启apache服务
restart apache:
/etc/init.d/httpd restart
/etc/rc.d/init.d/httpd restart
note:
Goto http://localhost/svn/testrepo address and you should see something like following, write username and password:
url:http://localhost/svn/testrepo
如果此处出现用户名和密码验证失败
现象:输入用户名和密码之后点击LOGIN跳转不过去
解决:
首先检查svnserve.conf文件,看有没有把password-db = passwd前对#去掉,并且要顶格;
authz-db = authz同理,修改realm = My First Repository,改为自己的服务器地址,
前面的#号也要去掉,顶格然后要注意authz文件里目录格式是否正确,要用/配置权限的时候要顶格.
编辑:访问控制文件
[admin@localhost tmp]$ cat svn-access-control
[groups]
devgroup = testuser,testuser2
testgroup = tester
[/]
* = r
@devgroup = rw
devgroup = rw
[testrepo:/]
@devgroup = rw
@testgroup =r
[testrepo:/trunk]
@devgroup = rw
@testgroup =r
[testrepo:/tags]
@devgroup = rw
@testgroup =r
[testrepo:/]
@testgroup =r
[testrepo:/trunk]
@testgroup =r
[testrepo:/tags]
@testgroup =r
[admin@localhost tmp]$
Configure repository 配置库文件
To disable anonymous access and enable access control add following rows to testrepo/conf/svnserve.conf file:
## Disable anonymous access ## anon-access = none ## Enable access control ## authz-db = authz
## Disable anonymous access ##
anon - access = none
## Enable access control ##
authz - db = authz
添加代码库:
Create trunk, branches and tags structure under myapprepo
Create “template” directories with following command:
mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}
Then import template to project repository using “svn import” command:
svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/svn/myapprepo/
Adding /tmp/svn-structure-template/trunk
Adding /tmp/svn-structure-template/branches
Adding /tmp/svn-structure-template/tags Committed revision
Committed revision 4.
=======================================================================
参考:http://www.if-not-true-then-false.com/2010/install-svn-subversion-server-on-fedora-centos-red-hat-rhel/
centos6.6基于apache环境SVN配置
原创orange_hui 博主文章分类:linux系统管理 ©著作权
文章标签 centos svn 文章分类 开源
上一篇:Win7 VMWare虚拟机无线上网设置图解(已测可用)
下一篇:励志语录
-
CentOS/Debian 配置系统中文语言及环境
CentOS/Debian 配置系统中文语言及环境
CentOS Debian 中文 环境 -
Centos6.6下SVN配合Apache
Centos6.6下SVN配合Apache
Centos6.6下SVN配合Apach -
Centos6.6安装配置wordpress
Centos安装wordpress
Centos wordpress