Install svn and configuration through yum in linux, yumsvn
1. Environment
Centos6.4
2. Install svn
Yum-y install subversion
3. Configuration
Create a version library directory
Mkdir/www/svndata
Svnserve-d-r/www/svndata
4. Create a version Library
Create a new Subversion Project
Svnadmin create/var/www/svndata/njlrxx
Configure to allow users to access jiqing
Cd/var/www/svndata/njlrxx/conf
Vi svnserve. conf
Anon-access = none
Auth-access = write
Password-db = passwd
Note: there must be no space before the modified file; otherwise, an error occurred while starting the svn server.
Vi passwd
[Users]
# <User 1 >=< password 1>
# <User 2 >=< password 2>
Jiqing = 123456
5. Client Connection
Svn co svn: // ip/njlrxx
Username: jiqing
Password 123456
========================================================== ======================================
6. To synchronize SVN and WEB, you can CO it or directly configure it in the repository.
1) set the root directory of the WEB server to/var/www/webroot.
2) checkout SVN
Svn co svn: // localhost/njlrxx/var/www/webroot/njlrxx
Modify permissions to WEB users
Chown-R apache: apache/var/www/webroot/njlrxx
3) create a synchronization script
Cd/var/www/svndata/njlrxx/hooks/
Cppost-commit.tmpl post-commit
Edit post-commit and add the following content at the end of the file:
REPOS="$1"REV="$2"BASEPATH=/var/www/webroot/njlrxxWEBPATH="$BASEPATH/"export LANG=zh_CN.UTF-8svn update $WEBPATH --username jiqing --password 123456 --no-auth-cache
Add script execution permission
Chmod + x post-commit
The final operation is to close the service and then open the service:
Close the svn service:
Killall svnserve
Svn enabled:
Svnserve-d-r/var/www/svndata
========================================================== ======================================
SVN automatic synchronization Program Execution Process:
1. the user submits the file to the SVN server and triggers the post-commit script after the submission is successful.
2. Run the PHP script in the post-commit file using php_script.php.
3. Update the working copy of the version library on the server through the exec system call in the PHP script
4. perform operations on another SVN version Library Based on the update operation result log