回忆之城
生命在于折腾
posts - 575,comments - 9,trackbacks - 0

http://wiki.centos.org/zh/HowTos/Subversion

http://wiki.centos.org/HowTos/Subversion

1、检查系统是否安装了httpd

rpm -qa httpd

如果没有,使用下面命令安装

yum install httpd

启动apache

service httpd start

访问http://localhost

如果看到下面信息,则说明安装成功

Apache 2 Test Page
powered by CentOS

 

2、yum install subversion apr apr-util

如果系统是64位的,则安装64位的subversion即可。安装完成后查看是否安装成功

[root@cnn001 ~]# svnserve --version
svnserve, version 1.6.11 (r934486)
   compiled May 14 2012, 05:36:18

Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository back-end (FS) modules are available:

* fs_base : Module for working with a Berkeley DB repository.
* fs_fs : Module for working with a plain file (FSFS) repository.

Cyrus SASL authentication is available.

 

创建版本存放目录

[root@cnn001 ~]# mkdir -p /svn/repos

创建版本仓库

[root@cnn001 ~]# svnadmin create /svn/repos

查看仓库信息
[root@cnn001 ~]# ls /svn/repos/
conf  db  format  hooks  locks  README.txt

修改目录权限,否则无法导入项目

[root@cnn001 ~]# chown -R apache.apache /svn/repos

 

配置apache,在subversion.conf最后添加如下内容:

[root@cnn001 conf]# vim /etc/httpd/conf.d/subversion.conf 

<Location /svn>
DAV svn
SVNPath /svn/repos
AuthType Basic
AuthName "Subversion"
AuthUserFile /etc/httpd/conf.d/passwd
AuthzSVNAccessFile /etc/httpd/conf.d/authz(可以不要)
Require valid-user
</Location>

 

配置passwd文件

[root@cnn001 conf.d]# htpasswd -cm passwd v_jazheng
New password:
Re-type new password:
Adding password for user v_jazheng
[root@cnn001 conf.d]# htpasswd -m passwd svnadmin
New password:
Re-type new password:
Adding password for user svnadmin

 

重启httpd服务,出现以下错误:

[root@cnn001 conf]# service httpd restart

Starting httpd: Syntax error on line 993 of /etc/httpd/conf/httpd.conf:
Unknown DAV provider: svn

 

这是因为系统没有安装mod_dav_svn,它是Subversion与Apache之间的接口(通过它,Apache就可以访问版本库,可以让客户端也使用HTTP的扩展协议 WebDAV/DeltaV进行访问)

[root@cnn001 conf]# yum install mod_dav_svn

 

[root@cnn001 conf]# ls /etc/httpd/modules/ | grep svn
mod_authz_svn.so
mod_dav_svn.so

  

使用本地文件系统把/ta_parser项目导入到svn

[root@cnn001 ta_parser]# svn import /ta_parser http://svn/repos/tap/ta_parser -m "the tap parser project"
Adding         /ta_parser/HelloWorld.java

Committed revision 1.

 

(如果使用apache作为svn协议,以下配置可以省略) 

修改svn配置文件
[root@cnn001 conf]# pwd
/svn/repos/conf

[root@cnn001 conf]# vim svnserve.conf

[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz

 

[root@cnn001 conf]# vim authz

[groups]
hadoop = v_jazheng,v_jazhou
admin = svnadmin


[/]
* = r
@admin = rw


[ta_parser:/]
@hadoop = rw

 

[root@cnn001 conf]# vim passwd

[users]
v_jazheng = 123456
v_jazhou = 123456
svnadmin = 123456

 

启动svnserve
[root@cnn001 ~]# svnserve -d -r /svn/project

查看启动是否成功

[root@cnn001 ~]# ps -ef|grep svnserve
root      2430     1  0 23:39 ?        00:00:00 svnserve -d -r /svn/repos
root      2434  2278  0 23:40 pts/1    00:00:00 grep svnserve

 

[root@cnn001 ~]# svn co svn://cnn001/tap/ta_parser
Authentication realm: <svn://cnn001:3690> 343561b3-335f-46b2-803b-3728b66d7673
Password for 'root':
Authentication realm: <svn://cnn001:3690> 343561b3-335f-46b2-803b-3728b66d7673
Username: v_jazheng
Password for 'v_jazheng':

-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <svn://cnn001:3690> 343561b3-335f-46b2-803b-3728b66d7673

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)? yes
A    ta_parser/HelloWorld.java
Checked out revision 1.

 

此时,在当前目录下check out ta_parser项目
[root@cnn001 ta_parser]# pwd
/root/ta_parser

[root@cnn001 ta_parser]# ls -a
.  ..  HelloWorld.java  .svn

  

在浏览器中访问http://10.0.30.245/svn/tap/ta_parser,成功!

 

顺便说一下:如何在eclipse中删除svn密码,只要移除目录~/.subversion/auth/svn.simple下面的文件即可。

posted on 2013-08-20 16:07 回忆之城 阅读(153) 评论(0)  编辑 收藏 引用 所属分类: unix/linux
只有注册用户登录后才能发表评论。