I'm a tree and wating for the spring!
|

【原创】yum安装svn服务器

★作者:桐星豆博客   |  ★类别: Linux   |  ★发布时间: 2013-12-15 15:51   |  ★更新时间: 2013-12-15 15:56   |  ★浏览次数:2405   |  ★ 评论(2)

文章导航
1、检查subversion安装包
2、升级安装subversion
3、创建SVN版本库
4、配置文件概述
    4.1、svnserve.conf
    4.2、passwd
    4.3、authz
5、启动SVN服务
6、停止SVN服务
7、访问方式

Linux中安装SVN的方式有很多种,包括源码安装、rpm包安装还有yum安装等等,我比较倾向于使用yum,所以本篇文章中只介绍使用yum进行SVN服务器的部署。

本文偏向于对SVN服务器部署过程的记录,不会对相关知识进行介绍,比如什么是SVN、什么是yum等等。下面介绍一下本文示范的服务器背景:

LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: CentOS
Description: CentOS release 5.5 (Final)
Release: 5.5
Codename: Final

好啦,下面真正开始喽!

 

1、检查subversion安装包

# yum list |grep subversion
subversion.i386                          1.4.2-4.el5_3.1               installed
subversion.i386                          1.6.11-11.el5_9              base    
subversion-devel.i386                  1.6.11-11.el5_9              base    
subversion-javahl.i386                  1.6.11-11.el5_9              base    
subversion-perl.i386                    1.6.11-11.el5_9              base    
subversion-ruby.i386                   1.6.11-11.el5_9              base

从运行的结果中可以知道,在这台服务器上,已经安装过SVN啦,不过版本比较低啊,目前最新版本都到1.8了,这个才1.4,那么我们使用yum更新到最新版本吧,更新之前先看看本服务器yum仓库提供的最新版本是哪个吧,如果还是1.4的话就没必要更新啦:

# yum check-update subversion

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.bit.edu.cn
 * base: mirrors.yun-idc.com
 * extras: mirror.bit.edu.cn
 * updates: mirror.bit.edu.cn

subversion.i386                                                     1.6.11-11.el5_9

 

2、升级安装subversion

从运行的结果可以看到,仓库中最新版本是1.6,比现在安装的版本高,那我们就更新安装一下本地的SVN服务器吧:

# yum update subversion
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.bit.edu.cn
 * base: mirrors.yun-idc.com
 * extras: mirror.bit.edu.cn
 * updates: mirror.bit.edu.cn
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package subversion.i386 0:1.6.11-11.el5_9 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================
 Package                            Arch                         Version                                 Repository                    Size
===========================================================================
Updating:
 subversion                         i386                         1.6.11-11.el5_9                         base                         3.1 M

Transaction Summary
===========================================================================
Install       0 Package(s)
Upgrade       1 Package(s)

Total download size: 3.1 M
Is this ok [y/N]: y # 这里输入y后回车,同意下载并安装

Downloading Packages:
subversion-1.6.11-11.el5_9.i386.rpm                                                                                  | 3.1 MB     00:09    
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : subversion                                                                                                           1/2
  Cleanup        : subversion                                                                                                           2/2

Updated:
  subversion.i386 0:1.6.11-11.el5_9                                                                                                    

Complete!

# yum list |grep subversion
subversion.i386                            1.6.11-11.el5_9               installed
subversion-devel.i386                   1.6.11-11.el5_9               base    
subversion-javahl.i386                   1.6.11-11.el5_9               base    
subversion-perl.i386                      1.6.11-11.el5_9               base    
subversion-ruby.i386                     1.6.11-11.el5_9               base

嗯,不错,已经更新安装到仓库中的最新版本啦,下面我们一起进入SVN服务器的配置阶段!

 

3、创建SVN版本库

# mkdir -p /data/svndata

# svnadmin create /data/svndata/svnroot  #其中svnroot是版本库的名称

 

4、配置文件概述

路径/data/svndata/svnroot/conf下的配置文件有如下3个:
authz                    权限配置文件,该文件名在文件svnserve.conf中指定,缺省为同目录下的
passwd                 用户名口令文件,该文件名在文件svnserve.conf中指定,缺省为同目录下的
svnserve.conf        SVN服务配置文件,位于各个当前版本库目录的conf目录下

下面分别对这3个文件的配置进行详细说明:

 

4.1、svnserve.conf文件

打开svnserve.conf文件,内容如下,主要配置有5项,请留意红颜色部分:

### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)
### Visit http://subversion.tigris.org/ for more information.
[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### and "none".  The sample settings below are the defaults.
anon-access = read #控制非鉴权用户访问版本库的权限,如果不允许非鉴权用户,可以设置为 none
auth-access = write #控制鉴权用户访问版本库的权限
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd #指定用户名口令文件名
### The authz-db option controls the location of the authorization
### rules for path-based access control.  Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file.  If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz #指定权限配置文件名,通过该文件可以实现以路径为基础的访问控制
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
realm = xyxy.tk's svnroot #指定版本库的认证域,即在登录时提示的认证域名称。若两个版本库的认证域相同,建议使用相同的用户名口令数据文件
[sasl]
### This option specifies whether you want to use the Cyrus SASL
### library for authentication. Default is false.
### This section will be ignored if svnserve is not built with Cyrus
### SASL support; to check, run 'svnserve --version' and look for a line
### reading 'Cyrus SASL authentication is available.'
# use-sasl = true
### These options specify the desired strength of the security layer
### that you want SASL to provide. 0 means no encryption, 1 means
### integrity-checking only, values larger than 1 are correlated
### to the effective key length for encryption (e.g. 128 means 128-bit
### encryption). The values below are the defaults.
# min-encryption = 0
# max-encryption = 256

 

4.2、passwd文件

passwd的内容如下,没什么可说的

### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.
[users]
# harry = harryssecret
# sally = sallyssecret

 

4.3、authz文件

### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').
[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
# [/foo/bar]
# harry = rw
# &joe = r
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

authz文件配置也非常简单,官网已经给与了很详细的提示了,我提供一个范例吧:

[groups]       #设置组
admin = user1
[/]              #根目录权限设置(就是“svndata”这个文件夹)
user1 = rw      #用户1权限是:可读写
user2 = r        #用户2权限是:可读,不可写
@admin = rw    #设置组权限
[svndata:/svnroot]     设置根目录下“svnroot”文件夹的权限
user1 = rw
user2 = r

 

5、启动SVN服务
# svnserve -d -r /data/svndata/
-d表示后台运行
-r 指定根目录是 /data/svndata/

PS:也可以指定其他的端口号,加上参数 --listen-port=端口号。别忘记配置成随系统启动SVN服务!

 

6、停止SVN服务
# ps -aux |grep svn
kill -9 进程杀掉

 

7、访问方式

到此为止,SVN服务器的部署就告一段落了,访问的时候只能用“svn://ip或域名:端口/版本库名称”访问,如果端口是默认的3690,则不需要填端口号,例如“svn://www.xyxy.tk/svnroot”。后续将会添加WEB访问的支持,以及报表、邮件通知等部署和配置!

请尊重他人的劳动果实,转载时务必注明出处! 请尊重他人的劳动果实,转载时务必注明出处!
转载请注明:文章转载自:桐星豆博客 [http://blog.txdou.com]
本文标题:【原创】yum安装svn服务器
本文地址:http://blog.txdou.com/article94
分享到QQ空间 分享到腾讯朋友

  • 注意:“桐星豆博客”只会以“回复”的身份出现,不会以“咨询”的身份出现在留言或评论中,凡是以“咨询”的身份出现的留言或评论均为他人盗用!
  • 本站用以回复网友评论的唯一名称是“桐星豆博客”,除此外均无效,网友不得用此名进行相应文章的评论或回复!
  • 用户言论只代表其个人观点,不代表桐星豆博客的观点或立场!
  • 非诚勿扰,请友好如实的评论,杜绝谩骂、人格攻击等一切伤人言论,请严格遵循中华人民共和国法律法规!
  • 桐星豆博客拥有最终解释权,如有网友违规,本站将有权删除或屏蔽违规评论,情节严重者账户加入黑名单、永久封IP并报司法部门严惩!
  • 您一旦参与评论本站则默认为您已经同意以上条款,否则“非诚勿扰”,谢谢合作!

您的姓名或昵称: 选填
您的E-Mail地址: ☆必填--仅站长可见
您个人网站地址: 选填 ( 如果填写,请务必加上 http:// 或 https:// 等等 )
留言内容:

验证码: 点击重新生成验证码  [ ctrl + enter ]

CopyRight © 2009-2020 by 桐星豆 All Rights Reserved. ICP证:京ICP备20021364号