Install svn on CentOS 6.5 x64
# Svn Installation
Yum install-y subversion
Uninstall the old version of svn
Yum remove-y subversion
Wget http://pkgs.repoforge.org/subversion/subversion-1.7.4-0.1.el6.rfx.x86_64.rpm
Install new version
Rpm-ivh subversion-1.7.4-0.1.el6.rfx.x86_64.rpm
Create svn root directory
Mkdir/svndata
Create svn public configuration directory
Mkdir-p/usr/local/subversion/conf
Cd/usr/local/subversion/conf
Edit User File authz
The content is as follows:
[Groups]
Backend = zty
[/]
Whh = rw
@ Backend = rw
Explanation:
Backend indicates a user group. @ backend = rw indicates that the user group has read and write permissions.
Whh is used to run the hook script. You can obtain the name as needed. The following describes the hook script.
If you need to add user zhang, modify backend = zty and add the following content. Multiple users are separated by commas (,). The effect is as follows:
Backend = zty, zhang
Edit Password File passwd
The content is as follows:
[Users]
Whh = whh
Zty = zty123
Explanation:
The user is on the left and the password is on the right.
Create bin directory
Mkdir-p/usr/local/subversion/bin
Link file
Ln-s/usr/bin/svn/usr/local/subversion/bin/svn
Create svn root directory
Mkdir/svndata
Create svn log directory
Mkdir/var/log/svn
Create a data transmission project check-out Directory, which must be empty.
Generally, the svn server and website server are on the same server.
The root directory of the website server is/www, so the path detected by the dts project from svn is also under the/www directory.
Once the client submits the code and accesses the webpage, you can see the effect.
Mkdir/www/dts
Create a project
Cd/svndata
Svnadmin create dts
Edit configuration file
Cd/svndata/www/dts/conf/
Edit the configuration file svnserve. conf
Clear all content
Write the following content:
[General]
Anon-access = none
Auth-access = write
Password-db =/usr/local/subversion/conf/passwd
Authz-db =/usr/local/subversion/conf/authz
Realm = web
[Sasl]
# Use-sasl = true
# Min-encryption = 0
# Max-encryption = 256
Specify the user and password configuration file as a public directory. If a new project is also specified as a public directory, you only need to modify the files in the public directory and use the specified user and password to access other related projects.
In the case of numerous projects and uniform personnel permissions, It is necessary.
If the company has more than 60 projects and a new employee wants to add an account, it is very difficult to change the configuration of each project.
If both are specified as public directories, you only need to change the files authz and passwd.
Edit the hook file. The default post-commit file does not exist.
Vim/svndata/www/dts/hooks/post-commit
The content is as follows:
#! /Bin/sh
/Usr/local/subversion/bin/svn update -- username whh -- password whh/www/dts/>/var/log/svn/dts. log
Set permissions
Chmod 755/svndata/www/dts/hooks/post-commit
The function of the hook script is explained here.
After the client successfully submits the file, it will automatically execute post-commit. Check the updated code to the specified directory to ensure that the submitted code is consistent with that on the server.
Note that you should not directly specify the directory on the server. This refers to/www/dts/editing the file. Otherwise, a file conflict is prompted after the client submits the file.
Start svn
Svnserve-d-r/svndata
Note: You must manually check one copy; otherwise, post-commit does not take effect.
Svn co file: // svndata/www/dts // www/dts/
Execute the command again
/Usr/local/subversion/bin/svn update -- username whh -- password whh/www/dts/
Use the svn client to upload code for testing
Check whether uploaded files exist in the server/www/dts/directory.