Centos系统下安装配置SVN

1.安装SVN服务

#检查现有版本
rpm -qa subversion


#如果存储旧版本,卸载旧版本SVN
yum remove subversion


#安装SVN
yum install subversion


#验证安装
svnserve --version

[root@localhost /]# svnserve --version
svnserve,version 1.7.14 (r1542130)
   compiled Nov 20 2015,19:25:09

Copyright (C) 2013 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 http://subversion.apache.org/

The following repository back-end (FS) modules are available:

* fs_base : Module for working with a Berkeley DB repository.
* fs_fs : Module for working with a plain file (FSFS) repository.

Cyrus SASL authentication is available.

2.创建代码库并分配权限

#代码库创建

SVN软件安装完成后还需要建立SVN库

mkdir -p /data/svn/systemCenter
svnadmin create /data/svn/systemCenter

执行上面的命令后,自动建立repo测试库,查看/data/svn/systemCenter文件夹发现包含了conf,db,format,hooks,locks,README.txt等文件,说明一个SVN库已经建立。

#配置代码库

进入上面生成的文件夹conf下,进行配置

操作有如下三个步骤:

新增用户;
编辑分组;
编辑组权限;

用户信息文件:svn/systemCenter/conf/passwd
分组及权限文件:svn/systemCenter/conf/authz

以下为详细步骤:
1.创建用户
eg:
harry = harryssecret
sally = sallyssecret
说明:用户名和密码成对出现,harry表示用户名,harryssecret表示密码,"="两边均保留一个空格,
2.分组;
eg:
##共分了三个组
[groups]
admin_group = admin,xxx
comm_group = yyy
说明:表示将对应的用户放在不同分组内;
3.按组划分权限;
eg:
##管理员
[/]
@admin_group = rw
##通讯小组
[/Comm]
@comm_group = rw
##爬虫组
[/Crawler]
@crawler_group=rw
说明:表示共分了三个组,每个组能访问的目录为"[]"内的目录;

3.配置svnserve.conf

vi svnserve.conf
打开下面的5个注释
anon-access = read #匿名用户可读
auth-access = write #授权用户可写
password-db = passwd #使用哪个文件作为账号文件
authz-db = authz #使用哪个文件作为权限文件
realm = /home/svn # 认证空间名,版本库所在目录

4.通过apache配置svn

<Location /repos>
DAV svn
SVNParentPath /data/svn/repos
AuthName "--- System Development Department SVN Server ---"
AuthType Basic
AuthUserFile /data/svn/repos/conf/passwd
AuthzSVNAccessFile /data/svn/repos/conf/authz
Require valid-user
</Location>

5.常见问题

1>SVN 报错:Unable to create pristine install stream

解决办法:在.svn文件夾下手動新建文件夾tmp

相关文章

linux下开机自启: 在/etc/init.d目录下新建文件elasticsear...
1、因为在centos7中/etc/rc.d/rc.local的权限被降低了,所以...
最简单的查看方法可以使用ls -ll、ls-lh命令进行查看,当使用...
ASP.NET Core应用程序发布linux在shell中运行是正常的。可一...
设置时区(CentOS 7) 先执行命令timedatectl status|grep &...
vim&#160;/etc/sysconfig/network-scripts/ifcfg-eth0 B...