SVN安装(linux)

本文详细介绍了在Linux(Redhat 6.4)系统中安装和配置SVN服务的过程,包括检查和安装SVN软件,创建SVN版本库数据存储根目录,启动SVN服务,以及创建项目版本库的步骤。此外,还强调了配置svnserve.conf文件以设置权限访问的重要性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

简介

svn是集中是版本控制系统
git是分布式版本控制系统
目前主流的还是svn,适合小团队开发进行版本控制。大团队使用会有弊端。

SVN服务端运行方式

SVN服务常见的运行方式有3种:
1、独立服务访问
访问地址如:svn://192.168.1.2/test
2、借助apache等http服务
访问地址如:http://svn.test.org/test
3、本地直接访问
访问地址如:file:///application/svndata/test
/application/svndata是svn数据库的路径

SVN档案库数据格式

BDB :关系数据库
FSFS :一些列二进制文件(默认安装是这种格式,更安全)
要了解这两种数据格式的区别可自行查找,这里主要介绍安装过程。

查询linux系统信息

查询linux版本(我这里用的linux系统是:redhat 6.4)

$cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.4(santiago)

查询linux系统信息

$uname -rm
2.6.32-358.el6.i686 i686

SVN安装

1)首先检查svn软件程序是否已经安装

rpm –aq subversion

返回内容:subversion-1.6.11-7.el6.i686

2)如果没有如上结果,则需要执行下面命令安装

yum –y install subversion

配置并启动SVN

建立SVN版本数据存储根目录(svndata)及用户、密码权限目录(svnpasswd)

mkdir -p /application/svndata<==数据存储根目录

mkdir -p /application/svnpasswd<==用户、密码权限目录

启动SVN服务

svnserve -d -r /application/test/

提示:如果有什么不懂的可以使用svnserve --help查看

查看SVN进程是否已经启动

$ps -ef | grep svn

dev       4445     1  0 10:01 ?        00:00:00 svnserve -d -r /application/svndata/

这个已经证明SVN服务已经启动成功

创建项目版本库

创建一个新的subversion项目test,其实,类似test这样的项目可以创建多个,每个项目对应不同的代码,这里只是以创建一个项目为例。

svnadmin create /application/svndata/test


在/application/svndata/test/目录下将创建这么多文件

最重要的是/application/svndata/test/conf目录

authz  passwd  svnserve.conf包含这三个文件

其中svnserve.conf是整个服务的配置文件

打开这个文件看一下内容:

### 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
# 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 = My First Repository


[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

修改这个文件中的几个内容:(在修改这个文件之前最好进行备份)

anon-access = none

auth-access = write

password-db = /application/svnpasswd/passwd
authz-db = /application/svnpasswd/authz

然后将authz  passwd两个文件拷贝到/application/svnpsswd/目录下。
authz是权限控制
passwd是用户名和密码的配置
1、首先配置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
test1= test1 #添加的用户1
test2 = test2 # 添加的用户2
在这里配置了两个用户
2、配置用户权限
### 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


testgroup = test1,test2 #创建的用户组
[test:/]
test1 = rw #用户1
test2 = r #用户2
@testgroup = r #用户组

提示:如果修改了 svnserve.conf文件,需要重启服务。
pkill svnserve
svnserve -d -r /application/svndata/test

然后在windows上安装一个svn客户端,就可以连接svn服务器了

然后输入用户名和密码,一起就over了。经过测试没有问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值