Linux installation Configure SVN and set hooks

Source: Internet
Author: User
Tags svn update

Installation Instructions

System Environment: CentOS-6.3
Installation method: Yum Install (source installation is prone to version compatibility issues)
Install software: The system automatically downloads SVN software

Check for installed versions

#检查是否安装了低版本的SVN

Rpm-qa Subversion

#卸载旧版本SVN

Yum Remove Subversion
One. Install SVN
Yum-y Install Subversion
Verifying the installation

Verify that the SVN version information is installed

Svnserve--version
Code base Creation

SVN repository is also required after the installation

Mkdir-p/www/svndatasvnadmin Create/www/svndata/test

After executing the above command, automatically establish the Svndata library, view the/www/svndata/test folder discovery contains Conf, db,format,hooks, locks, README.txt and other files, stating that an SVN repository has been established.

Configuring the Code base

Go to the folder created above conf, configure

Cd/www/svndata/test/conf
User Password passwd configuration
Cd/www/svndata/test/confvim passwd

Modify passwd to the following:

Permissions Control Authz Configuration
Vim Authz

The goal is to set which users can access which directories, append the following to the Authz file:

Service svnserve.conf Configuration
Vim svnserve.conf

Append the following content:

[General] #匿名访问的权限, can be read,write,none, the default is readanon-access=none# enables authorized users to have write permissions auth-access=write# the path of the password database password-db= passwd# access Control File authz-db=authz# authentication namespace, Subversion is displayed in the authentication prompt, and as the credential cache keyword Realm = My first Repository
Start SVN
Svnserve-d-r/www/svndata
View SVN process
[[email protected] conf]# ps-ef|grep svn|grep-v greproot     12538     1  0 14:40?        00:00:00 svnserve-d-r/www/svndata
Detecting SVN ports
[[email protected] conf]# netstat-ln |grep 3690tcp        0      0 0.0.0.0:3690                0.0.0.0:*                   LISTEN
Stop restarting SVN
[Email protected] password]# Killall Svnserve    
Test

The SVN service is started and the connection is tested using the client.
Client Connection Address: Svn://xxx.xxx.xxx.xxx/test
Username/password: cqh/123456
Tests the creation of folders and other operations.

two. Set Hook Automatic Update

The implementation of SVN and Web synchronization, can be co-one out, or directly with the method of updating the Web directory, we have to configure the SVN repository hook to implement, is to create a post-commit configuration file, simple configuration, Simple four-step implementation of the Linux SVN Automatic Update web directory configuration.
The first step: Build your Web application directory

Enter the Web program directory you created (SVN checkout can be abbreviated as CO)

Step Two: Create a new Post-commit file "Hook script" in the hooks/directory of the project library

Add the script content as follows

Export Lang=en_us. UTF-8SVN=/USR/BIN/SVN            #这里配置的是svn安装bin目录下的svn文件WEB =/var/www/html/test      #要更新的目录 $SVN update $WEB--username CQH--password 123456chown-r www:www  $WEB

Where svn= right is changed to SVN command location
web= right to your actual WEB directory

Step three: Let Post-commit have permission to execute

chmod a+x Post-commit

Fourth Step: This is done, and the fourth step is the test.

Description
Export Lang=en_us. UTF-8 is to solve the SVN post commit Chinese garbled, set the localization code, because my system for UTF8 encoding, in fact, svn default is UTF-8 encoding, if the encoding is GBK, do not set the error will occur, and the execution is unsuccessful, the error is identified as

Update Operation/USR/BIN/SVN Update--username CQH--password 123456/var/www/html/test
If prompted:

Post-commit Hook failed (exit code 255) with no output

Give Post-commit files permission to execute
If your default encoding is UTF-8, to upload a Chinese file, save the file in UTF-8 format before submitting

This article references

http://lhkzyz.iteye.com/blog/1666180

Http://www.cnblogs.com/davidgu/archive/2013/02/01/2889457.html

Linux installation Configure SVN and set hooks

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.