SVN Create Repository
Using the svn command to create a repository:
[tutorialpro@centos6 ~]# svnadmin create /opt/svn/tutorialpro01
[tutorialpro@centos6 ~]# ll /opt/svn/tutorialpro01/
total 24
drwxr-xr-x 2 root root 4096 2016/08/23 16:31:06 conf
drwxr-sr-x 6 root root 4096 2016/08/23 16:31:06 db
-r--r--r-- 1 root root 2 2016/08/23 16:31:06 format
drwxr-xr-x 2 root root 4096 2016/08/23 16:31:06 hooks
drwxr-xr-x 2 root root 4096 2016/08/23 16:31:06 locks
-rw-r--r-- 1 root root 229 2016/08/23 16:31:06 README.txt
Enter the /opt/svn/tutorialpro01/conf
directory and modify the default configuration files, including svnserve.conf
, passwd
, and authz
to configure users and permissions.
- SVN Service Configuration File
svnserve.conf
The SVN service configuration file is located in the repository directory at conf/svnserve.conf
. This file consists of a single [general]
configuration section.
[general]
anon-access = none
auth-access = write
password-db = /home/svn/passwd
authz-db = /home/svn/authz
realm = tiku
anon-access: Controls the access permissions for non-authenticated users to the repository. The values can be "write", "read", or "none". "write" allows read and write access, "read" allows only read access, and "none" denies access. Default value: read.
auth-access: Controls the access permissions for authenticated users to the repository. The values can be "write", "read", or "none". "write" allows read and write access, "read" allows only read access, and "none" denies access. Default value: write.
authz-db: Specifies the authorization configuration file name, which enables path-based access control. Unless an absolute path is specified, the file location is relative to the
conf
directory. Default value: authz.realm: Specifies the authentication realm for the repository, which is the realm name prompted during login. If two repositories have the same realm, it is recommended to use the same username and password data file. Default value: a UUID (Universal Unique Identifier).
- Username and Password File
passwd
The username and password file is specified by the password-db
configuration item in svnserve.conf
, and defaults to passwd
in the conf
directory. This file consists of a single [users]
configuration section.
The configuration line format in the [users]
section is as follows:
<username> = <password>
[users]
admin = admin
thinker = 123456
- Permissions Configuration File
The permissions configuration file is specified by the authz-db
configuration item in svnserve.conf
, and defaults to authz
in the conf
directory. This configuration file consists of a [groups]
section and several repository path permission sections.
The configuration line format in the [groups]
section is as follows:
<group> = <user list>
The section name format for repository path permissions is as follows:
[<repository name>:<path>]
[groups]
g_admin = admin,thinker
[admintools:/]
@g_admin = rw
* =
[test:/home/thinker]
thinker = rw
* = r
This example uses svnserve -d -r /opt/svn to start SVN in multi-repository mode, so the URL is svn://192.168.0.1/tutorialpro01.