How to build SVN Server by Linux
This article focuses on "how to build a SVN server with Linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to build a SVN server with Linux.
1 install SVN
Download from the official website: http://subversion.apache.org/packages.html
SVN client: TortoiseSVN, official website download: http://tortoisesvn.net/downloads.html
# yum install subversion:
1. Create a new directory to store all SVN files
# mkdir / svn
two。 Create a new resource warehouse
# svnadmin create / svn/project # ls / svn/project/ conf db format hooks locks README.txt
Description of the purpose of the catalogue:
L hooks directory: the directory where the hook script files are placed
L locks directory: the directory where subversion's db lock files and db_logs lock files are placed, and used to track clients accessing the vault.
L format file: a text file with only an integer indicating the version number of the current vault configuration
L conf directory: is the configuration file for this warehouse (the user's access account, permissions, etc.)
3. Configure the configuration file for the svn service svnserver.conf file
# vi / svn/project/conf/svnserve.conf [general] anon-access = none auth-access = write password-db = / svn/project/conf/passwd authz-db = / svn/project/conf/authz realm = My Test Repository # this is a prompt
Save
4. Add two access users and password
# vi / svn/project/conf/passwd [users] xiaoran.shen = 123456 test1 = 123456 test2 = 123456
Save
Note: changes to the user profile take effect immediately, and there is no need to restart the svn service.
5. Configure authorization files for new users
# vi / svn/project/conf/authz [groups] admin = xiaoran.shen,test1 user = test2 [/] @ admin = rw @ user = r * =
Save
Format description:
Version library directory format:
[: / Project / Directory]
@ =
=
/ means to set permissions on all subdirectory scope under the root directory (that is, / svn/project directory)
[/ abc] means to set permissions on the abc project in the database
Create an admin group whose members include xiaoran.shen and test1
Create a user group with only test2 members
Admin group has read and write access to the directory
Individual user test2 has read and write permissions
* = indicates that all users except the permission group set above set null permissions, which means that access to this directory is prohibited, which is important to add.
Note: changes to the permission profile take effect immediately, and there is no need to restart svn.
6. Start the svn service
Svnserve-d-r / svn/project/
Note: do not use the / etc/init.d/svnserve start provided by the system to start, because the system default startup script does not specify a resource with the-r / svn/project parameter. For the svn service started in this case, the client connection will prompt an error such as "svn: No repository found in 'svn://192.168.11.229/project'".
The default svn server port is 3690.
Kill the svn service:
# ps-ef | grep svn root 4642 1 0 16:08? 00:00:00 svnserve-d-r / svn/project/ root 4692 3676 0 16:13 pts/2 00:00:00 grep svn # kill-9 4642
To use the / etc/init.d/svnserve script, you can modify the start () function section as follows:
Start () {[- x $exec] | | exit 5 [- f $config] | | exit 6 echo-n $"Starting $prog:" daemon-- pidfile=$ {pidfile} $exec $args-r / svn/project retval=$? Echo [$retval-eq 0] & & touch $lockfile return $retval}
Complete
2 use client connection
2.1 clients using windows
Open the TortoiseSVN Repository Browser tool
In URL, enter:
Enter svn://192.168.11.229 and prompt for a user name and password
2.2 use the command line under Linux
# svn co svn://192.168.11.229
3 FAQ
3.1 Command line connection, prompting svn: No repository found in 'svn://192.168.11.229/project' error?
Solution: the-r / svn/project parameter is not used when starting the svn service, and the specific path to the repository is not specified. Just start it with the # svnserve-d-r / svn/project/ command, not the / etc/init.d/svnserver script.
3.2 prompt "svn: Authorization failed" error when executing the command # svn co svn://192.168.11.229/project?
Solution: generally speaking, the error cause of this authorization failure comes from the configuration of the conf/authz file.
The correct configuration is as follows:
[groups] admin = xiaoran.shen,test1 user = test2 [/] @ admin = rw @ user = rw * = at this point, I believe you have a better understanding of "how to build a SVN server in Linux". Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!