Install and configure svn in centos6 and configure web synchronization

Source: Internet
Author: User
Tags svn svn client svn update

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.