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
#卸载旧版本SVN
One. Install SVN
1 |
yum -y install subversion |
Verifying the installation
Verify that the SVN version information is installed
Code base Creation
SVN repository is also required after the installation
12 |
mkdir -p /www/svndata svnadmin 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/conf vim passwd |
Modify passwd to the following:
1234 |
[users] # harry = harryssecret # sally = sallyssecret cqh=123456 |
Permissions Control Authz Configuration
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
Append the following content:
1234567891011 |
[general] #匿名访问的权限,可以是read,write,none,默认为read anon-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 grep root 12538 1 0 14:40 ? 00:00:00 svnserve -d -r /www/svndata |
Detecting SVN ports
12 |
[[email protected] conf]# netstat -ln |grep 3690 tcp 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-8 SVN=/usr/bin/svn #这里配置的是svn安装bin目录下的svn文件 WEB=/ var /www/html/test #要更新的目录 $SVN update $WEB --username cqh --password 123456 chown -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
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 ( 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
Reprint Friends: http://www.cnblogs.com/chenqionghe/p/4527763.html
Linux installation Configure SVN and set hooks