Svn Server installation and configuration, svn Server Configuration
1. Install svn server software
Download and install the SVN server software from the backup storage or YUM Source: yum install subversion
Mkdir/usr/local/svn // create the SVN installation directory
Chmod-R 777 svn // modify the directory permission to 777
Svnadmin create/usr/local/svn/sunny // create an SVN repository sunny (which can be customized by sunny)
Cd/usr/local/svn/sunny/conf // enter the configuration file directory under the sunny version Repository
Modify the three configuration files in this directory.
(1) vi svnserve. conf // configure the version library information and the path and version library path of the User File and user password file
# Anon-access = read
# Auth-access = write
# Password-db = passwd
// Remove the # And space in front of the four rows (note that the # must be written in the top level, and do not leave any extra space ).
Anon-access = none // anonymous access, changed to none
Auth-access = write
Password-db = passwd
Realm = sunny // change the name of your version Library
Save and exit
(2) vi authz // file, create SVN group and group User Permissions
[Group]
Sunny = gep, wce // create a sunny group and specify two users gep and wce
[/] // Specify permissions under the root directory
@ Sunny = rw // the sunny group user permission is read/write.
* = R // other users only have read permission
Save and exit
(3) vi passwd // create or modify the User Password
[Users]
Gep = 123456 // the password of the user whose username is gep is 123456
Wce = 123456 //...
Save and exit
Start the SVN Server:
// The multi-version library is used to start
Svnserve-d-r/usr/local/svn/
You can add a row for a single version library.
Svnserve-d-r/usr/local/svn/sunny
Set auto-start
'Open the self-starting file and add
/Usr/bin/svnserve-d-r/usr/local/svn/
So far, the file can be checked out from the server.
Svn command:
Netstat-tnl | grep: 3690 check whether svn is started
Installed successfully!
Ps aux | grep svn searches for all svn-started processes
Kill-9 2505 kill the svn process found in 2505
Svn checkout svn: // 172.19.5.2/sunny/data0/htdocs/blog // check out a version library file to the specified directory
Svn up // update the file
Automatic update
In vi/usr/local/svn/sunny/hooks/post-commit, add
#! /Bin/sh
# Set Some Variables
SVN =/usr/bin/svn
WEB =/home/testsvn # directory to be updated
Export LANG = en_US.UTF-8
$ SVN update $ WEB -- username xxx -- password xxx
SVN = the svn command location on the right is usually/usr/bin/svn by default.
WEB = change to your actual web directory on the right
Grant executable permissions
Chmod 777/usr/local/svn/sunny/hooks/post-commit
Installation Complete
========================================================== ======================================
Other operations
# Svn commit-m "comment" xxx. php // submit a file
Svn ci-m'aaa' test. php // submit a file
# Svn add file // create a file and add it to svn
Svn add *. php // (add all php files in the current directory)
Svn delete test. php // delete test. php
Svn log test. php // view the log information of the test File
Svn cleanup // clear the current directory
Svn switch -- relocate svn: // 192.168.1.253 svn: // 172.19.10.250 // locate the SVN repository address
// SVN version library startup mode. Now there are two versions of SVN: sunny and test.
1: Start svnserve-d-r/usr/local/svn/sunny for a single version
2: Start svnserve-d-r/usr/local/svn for multi-version Libraries
The difference is that the directory specified by the startup parameter-r in the command to start svn.
Restrict the operation permissions of different users on different version libraries, and modify the authz files under the conf directory in the version library.
Take sunny version library configuration as an Example
Vi authz
[Groups]
Teacher = sunny, sunny1
[Sunny: //] // specify the permission under the version library and Directory
@ Teacher = rw // The user permission of the teacher group is read/write.
* = R // other users only have read permission
Save and exit
Vi passwd: Set the account and password of the user in the group
[Users]
Sunny = 123456
Sunny1 = 123456