在CentOS6.7安装SVN和SVN钩子-创新互联

系统和版本:CentOS6.7+SVN1.6.11

创新互联公司专注于嘉定企业网站建设,自适应网站建设,商城网站定制开发。嘉定网站建设公司,为嘉定等地区提供建站服务。全流程按需策划设计,专业设计,全程项目跟踪,创新互联公司专业和态度为您提供的服务

Step 1: 安装Subversion

[root@80 ~]# yum install subversion

Step 2: 检查版本

[root@80 ~]# svn --version

Step 3: 创建SVN目录和仓库

[root@80 svn]# mkdir /opt/svn

[root@80 svn]# svnadmin create /opt/svn/test.localhost.com

Step 4: 添加用户和权限

[root@80 repos]# vim /opt/svn/test.localhost.com/conf/passwd

[users]

# harry = harryssecret

# sally = sallyssecret

jasonwu = jasonwupw

alanzhang = alanzhangpw

sky = skypw

joel = joelpw

[root@80 repos]# vim /opt/svn/test.localhost.com/conf/authz

[groups]

DEV  = joel,sky,alanzhang,jasonwu

[v2.test.localhost.com:/]

@DEV = rw

* =

Step 5: 修改配置文件

[root@80 repos]# vim /opt/svn/test.localhost.com/conf/svnserve.conf

anon-access = none

auth-access = write

password-db = /opt/svn/test.localhost.com/conf/passwd

authz-db = /opt/svn/test.localhost.com/conf/authz

realm = My First Repository

Step 6: 开启svn服务

[root@80 test.localhost.com]# svnserve -d -r /opt/svn

Step 7: checkout副本

[root@80 www]# svn co svn://192.168.11.80/test.localhost.com

Authentication realm: My First Repository

Password for 'joel':

Authentication realm: My First Repository

Username: joel

Password for 'joel':

Authentication realm: My First Repository

Username: sky

Password for 'sky':

-----------------------------------------------------------------------

ATTENTION!  Your password for authentication realm:

   My First Repository

can only be stored to disk unencrypted!  You are advised to configure

your system so that Subversion can store passwords encrypted, if

possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value

of the 'store-plaintext-passwords' option to either 'yes' or 'no' in

'/root/.subversion/servers'.

-----------------------------------------------------------------------

Store password unencrypted (yes/no)?

Step 8: 增加文件到SVN

[root@80 test.localhost.com]# vim test.txt

[root@80 test.localhost.com]# svn add *

A     test.txt

Step 9: 提交文件到SVN

[root@80 test.localhost.com]# svn commit * -m 'test'

Adding     test.txt

Transmitting file data .

Committed revision 1.

Step 10: 修改钩子

[root@80 www]# cd /opt/svn/test.localhost.com/

[root@80 test.localhost.com]# cd hooks/

[root@80 hooks]# vim post-commit

#!/bin/sh

#export LANG=zh_CN.UTF-8

SVN=/usr/bin/svn

WEB=/www/test.localhost.com

$SVN update $WEB  --username sky --password sky

[root@80 hooks]# chmod -R 755 post-commit

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


分享题目:在CentOS6.7安装SVN和SVN钩子-创新互联
新闻来源:http://myzitong.com/article/dhipeh.html