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

1 rpm -qa subversion

#卸载旧版本SVN

1 yum remove subversion
One. Install SVN
1 yum -y install subversion
Verifying the installation

Verify that the SVN version information is installed

1 svnserve --version
Code base Creation

SVN repository is also required after the installation

12 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

1 cd /www/svndata/test/conf
User Password passwd configuration
12 cd /www/svndata/test/confvim passwd

Modify passwd to the following:

1234 [users]# harry = harryssecret# sally = sallyssecretcqh=123456
Permissions Control Authz Configuration
1 vim authz

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

123 #设置[/]代表根目录下所有的资源[/]cqh=rw
Service svnserve.conf Configuration
1 vim svnserve.conf

Append the following content:

1234567891011 [general]#匿名访问的权限,可以是read,write,none,默认为readanon-access=none#使授权用户有写权限auth-access=write#密码数据库的路径password-db=passwd#访问控制文件authz-db=authz#认证命名空间,subversion会在认证提示里显示,并且作为凭证缓存的关键字realm = My First Repository
Start SVN
1 svnserve -d -r /www/svndata
View SVN process
12 [[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
12 [[email protected] conf]# netstat -ln |grep 3690tcp        0      0 0.0.0.0:3690                0.0.0.0:*                   LISTEN
Stop restarting SVN
12 [[email protected] password]# killall svnserve    //停止[[email protected] password]# svnserve -d -r /www/svndata // 启动
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

1 mkdir/var/www/html/test

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

12 svn checkout svn://localhost/svntest //不重命名文件夹,直接在当前目录下检出svn checkout svn://localhost/svntest test //检出文件并且重命名文件夹

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

Add the script content as follows

12345 export LANG=en_US.UTF-8SVN=/usr/bin/svn            #这里配置的是svn安装bin目录下的svn文件WEB=/var/www/html/test      #要更新的目录$SVNupdate $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

1 chmoda+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

1 svn: Can‘t convert string from native encoding to ‘GBK‘

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

1 post-commit hook failed (exitcode 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

Reprint Friends: http://www.cnblogs.com/chenqionghe/p/4527763.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.