Linux系统下部署SVN

时间:2018-11-03
本文章向大家介绍Linux系统下部署SVN,需要的朋友可以参考一下

Linux系统下部署SVN

1、安装

yum -y install subversion

2、创建版本库的上级目录

mkdir /var/svn/svnrepos

3、创建版本库app

svnadmin create /var/svn/svnrepos/app

注:可在svnrepos目录下创建多个版本库

每个版本库有如下文件:

conf  db  format  hooks  locks  README.txt
4、配置文件修改

svnserve.conf:svn服务器配置文件

authz:负责账号权限的管理,控制账号是否读写权限

passwd:负责账号和密码的用户名单管理

1)svnserve.conf文件配置

[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### and "none".  The sample settings below are the defaults.
# anon-access = read
# auth-access = write
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
# password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control.  Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file.  If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
# authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
# realm = My First Repository

默认不改变,则没有账号密码控制、没有权限控制,所有人可读可写

如下配置:

anon-access = none     匿名登录不予许---> 用户必须登录
auth-access = write      登录的用户拥有可读可写权限
password-db = passwd       维护用户登录的账号和密码
authz-db = authz       维护用户的权限
realm = My First Repository      领域值

a)配置:anon-access = none     匿名登录不予许---> 用户必须登录
        auth-access = write      登录的用户拥有可读可写权限

如果anon-access = none ,而没有打开password-db=passwd,则会出现不允许访问版本库:

配置:anon-access = none     匿名登录不予许---> 用户必须登录
   auth-access = write      登录的用户拥有可读可写权限
     password-db = passwd       维护用户登录的账号和密码

如果passwd中没有配置账号和密码,则也不能访问。

因此,必须正确配置账号和密码。【当然访问时候必须输入配置了的账号和密码,否则,验证不通过】

b)配置:anon-access = none     匿名登录不予许---> 用户必须登录
               auth-access = write      登录的用户拥有可读可写权限
               password-db = passwd       维护用户登录的账号和密码
               authz-db = authz       维护用户的权限

如果打开了authz-db = auth,但是authz中未配置登录用户的权限,则会出现认证错误:

因此,必须在权限文件authz中为用户配置正确的权限。

5、启动SVN和访问

svnserve -d -r /var/svn/svnrepos

启动时候可以指定目录是所有版本库的,也可以指定到某一个版本库。两种情况下,authz的权限配置会不一样。

6、访问svn版本库

小乌龟访问svn://ip:3690/app  【SVN启动默认的端口为3690,app为版本库】