Svn is a very good version manager, which can be used for division of work and version management program files.
1. Install svn
Run the following commands in sequence to install svn:
Yum install subversion
Cd/usr/local
Mkdir svn
Svnadmin create/usr/local/svn
Run the following command to check whether svn is successfully installed:
Svnserve -- version
> Svnserve, version 1.6.11 (r93411)
2. Configure the svn account
Log on to vpsmate and open/user/local/svn/conf as follows:
A. Append/usr/local/svn/conf/authz
[Groups]
[/]
SVN account username = rw
B. Append/usr/local/svn/conf/passwd
[Users]
SVN account username = SVN account password
C. Append/usr/local/svn/conf/svnserve. conf
[General]
# Preventing unauthorized users from accessing
Anon-access = none
# Grant write permission to authorized users
Auth-access = write
# Account and password configuration file
Password-db = passwd
# Directory and Project Authorization configuration file
Authz-db = authz
# Authentication namespace. The subversion is displayed in the authentication prompt and serves as the key word cached by the credential.
Realm = wwwweb
Start the svn service on the console:
Svnserve-d-r/usr/local/svn
After the svn account is configured, you can use the svn client to connect to svn: // IP address or website domain name.
3. Configure web synchronization
Files and folders uploaded to svn are saved in version management mode and cannot be directly read. Therefore, files in svn must be synchronized to the web Directory.
Open the/usr/local/svn/hooks Directory, create a post-commit file, and edit:
#! /Bin/sh
REPOS = "$1"
REV = "$2"
Export LANG = en_US.UTF-8
Svn update -- username SVN account username -- password SVN account password/usr/local/www
Then, use vpsmate to change the permission of the file to more than 0755.
Run the following commands to restart the svn service and perform the check-out operation in sequence. During the check-out operation, you may need to enter the root password and SVN account.
Killall svnserve & svnserve-d-r/usr/local/svn
Svn checkout svn: // IP address or domain name/usr/local/www
After the svn client operation file is submitted, the file can be synchronized to the web Directory.