您的位置:首页 > 其它

svn的安装与配置(转载)

2011-02-19 10:25 134 查看
一,Subversion有两种运行方式

[b]一种是基于Apache Http Server另外一种是Subversion Standalone Server。[/b]

以下是基于httpd的svn的安装

二,安装svn

yum install httpd httpd-devel subversion mod_dav_svn

如果你已经装了apache了,不想装二个apache的话。你可以单独下个subversion来装一下就行了。

注意一点的是,路径要正确:

#./configure –with-apxs=/apache路径/bin/apxs –prefix=/usr/local/subversion
–with-apr=/usr/local/apache2 –with-apr-util=/apache路径 –with-ssl –with-zlib
–enable-maintainer-mode

1),[b]确定已经安装了svn模块:mod_dav_svn[/b]

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

2),看一下svn是否已安装成功

[root@svn modules]# svn –version
svn, version 1.4.2 (r22196)
compiled Aug 10 2009, 18:00:04

Copyright (C) 2000-2006 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 access (RA) modules are available:

* ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.
- handles ‘http’ scheme
- handles ‘https’ scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
- handles ’svn’ scheme
* ra_local : Module for accessing a repository on local disk.
- handles ‘file’ scheme

三,创建仓库,修改svn配置文件

1),加载模块

[root@svn conf.d]#cd /etc/httpd/conf.d

[root@svn conf.d]# nano subversion.conf

添加以下二行

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

2),创建仓库,以及仓库目录的设置

# mkdir -p /var/www/svn

# cd /var/www/svn

# svnadmin create test

# chown -R apache.apache test

# vi /etc/httpd/conf.d/subversion.conf

<Location /svn>
DAV svn
#注意,下面的路径,子文件夹名不能和父文件名重复,不然就会出问题

SVNParentPath /var/www/svn/repository
#
# # Limit write permission to list of valid users.
# <LimitExcept GET PROPFIND OPTIONS REPORT>
# # Require SSL connection for password protection.
# # SSLRequireSSL
#
AuthType Basic
AuthName “Subversion repository”
AuthzSVNAccessFile /var/www/svn/repository/authz.conf
AuthUserFile /var/www/svn/repository/authfile
Require valid-user
# </LimitExcept>
</Location>

3),添加用户

下面建立可访问用户文件

# htpasswd -c /var/www/svn/repository/authfile 用户名


要增加用户,则使用下面命令

# htpasswd /var/www/svn/repository/authfile 用户名  4),权限分限 [code]# nano /var/www/svn/repository/authz.conf
[test:/] //这表示,仓库test的根目录下的访问权限
zhangy = rw //test仓库zhangy用户具有读和写权限
hunk = r //test仓库hunk用户具有读权限
[/] //这个表示在所有仓库的根目录下
* = r //这个表示对所有的用户都具有读权限
#[groups] //这个表示群组设置
#svn1-developers = zhangy, hunk //这个表示某群组里的成员
#svn2-developers = zhangy
#[svn1:/]
#@svn1-developers = rw //如果在前面加上@符号,则表示这是个群组权限设置

搞好之后重起apache

# service httpd restart

5),svn的一些操作
a.import操作
[root@svn www] svn import /var/www/zhangy/test/ file:///var/www/svn/repository/test -m "Initial repository test"
Adding         /var/www/zhangy/test.txt
Adding         /var/www/zhangy/test1.txt

注意:
1,file:///在这里是3个/,我开始导入时写成了二个,老是报错,我就很晕。
2,在导入时,如果存在中文字符的文件名导入会停止报错

b.check out操作
[root@svn www] cd /var/www
[root@svn www] svn co http://yoursvnserver/svn/test Authentication realm: <http://yoursvnserver:80> Subversion repositoryPassword for 'youruser':
A    test/test.txt
A    test/test1.txt
Checked out revision 1.

c.edit和commit操作
[root@svn www] cd /var/www
[root@svn www] nano test.txt -- 修改一些东西后.
[root@svn www] svn commit -m "Added a line to test.txt."
Sending        test/test.txt
Transmitting file data .
Committed revision 2.

d.add和delete操作
[root@svn www] svn co http://yoursvnserver/svn/test
[root@svn www] cd /var/www
[root@svn www] nano test2.txt -- 添加一个新文件.
[me@mylappy ~] svn add test2.txt
A         test2.txt

[me@mylappy ~] svn commit -m "new one"
Adding         test2.txt
Transmitting file data .
Committed revision 3.

删除操作把add换成delete就可以了

[/code]
[/code]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: