1. Environment
centos6.4
2. Install SVN
Yum-y Install Subversion
3. Configuration
Build the Repository Directory
Mkdir/www/svndata
Svnserve-d-r/www/svndata
4. Build the Repository
Create a new Subversion project
Svnadmin Create/var/www/svndata/njlrxx
Configuration allows user jiqing access
Cd/var/www/svndata/njlrxx/conf
VI svnserve.conf
Anon-access=none
Auth-access=write
password-db=passwd
Note: There must be no space in front of the modified file, otherwise there is an error starting SVN server
VI passwd
[Users]
#< User 1> = < password 1>
#< User 2> = < password 2>
jiqing=123456
5. Client Connection
SVN Co svn://ip/njlrxx
User name: jiqing
Password: 123456
===============================================================
6. Implement SVN synchronization with the Web, can be a co-or directly in the warehouse
1) Set the Web server root directory to/var/www/webroot
2) Checkout a copy of SVN
SVN Co svn://localhost/njlrxx/var/www/webroot/njlrxx
Modify permissions for Web users
Chown-r Apache:apache/var/www/webroot/njlrxx
3) Create a synchronization script
cd/var/www/svndata/njlrxx/hooks/
CP Post-commit.tmpl Post-commit
Edit Post-commit, add the following at the end of the file
Repos= "$" rev= "$" basepath=/var/www/webroot/njlrxxwebpath= "$BASEPATH/" Export LANG=ZH_CN. UTF-8SVN update $WEBPATH--username jiqing--password 123456--no-auth-cache
Increase script Execution permissions
chmod +x Post-commit
The last action is to turn off the service and then open the service:
The shutdown of the SVN service:
Killall Svnserve
SVN open:
Svnserve-d-r/var/www/svndata
===============================================================
SVN automatic synchronization program execution flow:
1, the user submits the file to the SVN server, the commit operation succeeds, triggers the Post-commit script
2. Execute PHP script in post-commit version file using php_script.php
3. Update the repository working copy on the server through the exec system call in the PHP script
4, according to the update operation results log, the other SVN repository for the corresponding operation processing
Solve the Chinese file garbled: Export lc_ctype= "en_US. UTF-8 "
Turn "http://www.cnblogs.com/jiqing9006/p/3370627.html"
Linux under SVN installation