Create a version Library folder
# Mkdir-p/data/svn/sinsvn
Create a version Library
# Svnadmin create/data/svn/sinsvn
# Mkdir-p/data/www/sinsvn
Import the project to the version library repository.
# Svn import/data/www/sinsvn/file: // data/svn/sinsvn-m "svn first test"
Check whether the import is successful
# Svn list-verbose file: // data/svn/sinsvn
Modify the configuration file of the version Library
# Vim/data/svn/sinsvn/conf/svnserve. conf
[General]
Anon-access = none
Auth-access = write
Password-db = ../passwd
Authz-db =.../../authz
Realm = sinsvn
Cp/data/svn/sinsvn/conf/passwd/data/svn
Cp/data/svn/sinsvn/conf/authz/data/svn
Modify the user files allowed to access the version Library
# Vim/data/svn/passwd
[Users]
Harry = harryssecret
Sin = sinssecret
Surpersin = surpersin
# Vim/data/svn/authz
[Groups]
Myteam = harry, sin
[/]
Surpersin = rw
[Sinsvn:/]
@ Myteam = rw
[Secsvn:/www]
@ Myteam = r
Sin = rw
[Sincms:/]
Sin = rw
Harry =
Start svn service
# Svnserve-d-r/data/svn/
Now, the version Library sinsvn can be used.
There are several solutions for multiple projects:
1. Start multiple svn services. Each SVN listens to different IP addresses or ports.
# Svnserve-d-listen-port 3690-r/data/svn1
# Svnserve-d-listen-port 3691-r/data/svn2
2. In a version library, you can divide directories by project and control the permissions of directories of various projects in authz.
[Sinsvn:/pro1]
Sin = rw
[Sinsvn:/pro2]
@ Myteam = rw
3. the SVN service listens to the root directory/data/svn of the version library, and then creates multiple version libraries under/data/svn. In the configuration files of each version Library, you can specify the user and permission file to the file in the root directory to manage them in a centralized manner. The above example already follows this practice.
# Svnserve-d-r/data/svn/
Svn automatic update hook:
# Cd/data/svn/sinsvn/hooks
# Cp post-commit.tmpl (post-commit)
# Vim post-commit
Export LANG = zh_CN.utf-8
REPOS = "$1 & Prime;
REV = "$2 & Prime;
SVN =/usr/bin/svn
WEB =/data/website/shebao/
LOG =/data/svn/logs/shebao. log
$ SVN update $ WEB-username ruesin-password ruesin
If [$? = 0]
Then
Echo "$ REPOS" "$ REV"> $ LOG
Echo 'date'> $ LOG
Echo "####################"> $ LOG
Fi