CentOS安装svn(subversion)版本管理

简介: SVN是Subversion的简称,是一个开放源代码的版本控制系统,它采用了分支管理系统。 svn服务器有2种运行方式:1.独立服务器 (url:svn://xxx.com/xxx);2.借助apache。(url:http://svn.xxx.com/xxx); svn存储版本数据也有2种方式:BDB(一种事务安全型表类型)和FSFS(一种不需要数据库的存储系统)。 因为BDB方式

SVN是Subversion的简称,是一个开放源代码的版本控制系统,它采用了分支管理系统。

svn服务器有2种运行方式:1.独立服务器 (url:svn://xxx.com/xxx);2.借助apache。(url:http://svn.xxx.com/xxx);
svn存储版本数据也有2种方式:BDB(一种事务安全型表类型)和FSFS(一种不需要数据库的存储系统)。
因为BDB方式在服务器中断时,有可能锁住数据,所以还是FSFS方式更安全一点。

1:yum安装svn服务器:

[root@CentOS-Slave1 svn]# yum -y install subversion
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
………………

Installed:
  subversion.x86_64 0:1.7.14-7.el7_1.1                                                                                                                                                         

Dependency Installed:
  apr.x86_64 0:1.4.8-3.el7        apr-util.x86_64 0:1.5.2-6.el7        neon.x86_64 0:0.30.0-3.el7   
  pakchois.x86_64 0:0.4-10.el7        subversion-libs.x86_64 0:1.7.14-7.el7_1.1       

Complete!

2:查看svn版本:

[root@CentOS-Slave1 svn]# svn --version
svn, version 1.7.14 (r1542130)
   compiled Sep  8 2015, 18:10:16
……………………

注:如果版本不合适,可以自己网络下载rpm或者wget安装!

地址之1:http://subversion.tigris.org/downloads/

3:创建svn仓库:

[root@CentOS-Slave1 /]# svnadmin create /home/svn/repository
4:创建成功查看svn仓库结构:
[root@CentOS-Slave1 /]# cd /home/svn/repository/
[root@CentOS-Slave1 repository]# ll
total 16
drwxr-xr-x. 2 root root   51 Oct 18 12:21 conf
drwxr-sr-x. 6 root root 4096 Oct 18 12:21 db
-r--r--r--. 1 root root    2 Oct 18 12:21 format
drwxr-xr-x. 2 root root 4096 Oct 18 12:21 hooks
drwxr-xr-x. 2 root root   39 Oct 18 12:21 locks
-rw-r--r--. 1 root root  229 Oct 18 12:21 README.txt
配置路径:
[root@CentOS-Slave1 conf]# ll
total 12
-rw-r--r--. 1 root root 1080 Oct 18 12:21 authz
-rw-r--r--. 1 root root  309 Oct 18 12:21 passwd
-rw-r--r--. 1 root root 3090 Oct 18 12:21 svnserve.conf
注:目录解说,文章最后备注附件!
5:详细配置备份附件,此处为快速配置:
权限配置文件authz,/ 为svn仓库根目录,下边追究用户:用户名 = 权限
[root@CentOS-Slave1 conf]# cat authz
[/]
tony = rw
用户名口令文件passwd,下边追究用户:用户名 = 口令(密码)
[root@CentOS-Slave1 conf]# cat passwd
[users]
tony = 123456
svn服务配置文件,svnserve.conf:
[root@CentOS-Slave1 conf]# cat svnserve.conf
[general]
anon-access = none
anon-access = write
password-db = passwd
authz-db = authz
realm = /home/svn/repository
详细说明和配置,备注附件!
6:启动svn服务:
[root@CentOS-Slave1 conf]# svnserve -d -r /home/svn/repository/
注: -d 表示守护进程, -r 表示在后台执行 ,顺序不能错,/home/svn/repository/  为svn的安装目录,如果是svn的仓库目录可能出错
***注:设置开机启动:
编辑文件:
vim /etc/rc.d/rc.local
/usr/bin/svnserve -d -r /home/svn
注:必须定位svn命令全路径!
7:本地安装客户端,访问:

8:然后从客户端,可以新建文件或者项目,Add到svn(右键单击->TortoiseSVN->有所有命令):

9:然后进行文件的commit提交:

10: 这就一次,新的上传项目,还可以update,reserve,delete等等的操作,上传结果:

11:上传到SVN的文件放在SVN服务器的哪个位置目录下?

[root@CentOS-Slave1 conf]# find / -name 测试文件夹
[root@CentOS-Slave1 conf]# 
答疑:
SVN服务器版本库有两种格式,一种为FSFS,一种为BDB:
把文件上传到SVN版本库后,上传的文件不再以文件原来的格式存储,而是被svn以它自定义的格式压缩成版本库数据,存放在版本库中;
如果是FSFS格式,这些数据存放在版本库的db目录中,里面的revs和revprops分别存放着每次提交的差异数据和日志等信息. 

错误1:Authorization failed

解决1:检查svn的3个配置文件,配置错误,请仔细检查

错误2:svn仓库不存在等错误,Target path '/repository' does not exist

[root@CentOS-Slave1 conf]# svnserve -d -r /home/svn/repository/
[root@CentOS-Slave1 conf]# ps -ef | grep svn
root      7800     1  0 13:43 ?        00:00:00 svnserve -d -r /home/svn/repository/
root      7805  5817  0 13:45 pts/3    00:00:00 grep --color=auto svn
[root@CentOS-Slave1 conf]# kill -9 7800
[root@CentOS-Slave1 conf]# svnserve -d -r /home/svn/

解决2:最后参数为svn的目录,去掉版本库名,启动!

备注附件:

详细配置文件:

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段配置用户组和用户
#引用用户组时要使用前缀"@"
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
# 多个用逗号隔开
developer = kaka,aiai
#版本库路径权限段的段名
#[<版本库名>:<路径>]
#可省略段名中的版本库名
#若省略版本库名,则该版本库路径权限段对所有版本库中相同路径的访问控制都有效
#"*"表示任何用户
#权限的取值范围为''、'r'和'rw',''表示对该版本库路径无任何权限,'r'表示具有只读权限,'rw'表示有读写权限
#注:每行配置只能配置单个用户或用户组
#可以按组分配权限,也可以用单个用户分配权限
#用户对repository下的coding目录权限
#[repository:/coding]
#@developer = rw
#* = r
#/代表仓库的根目录
[/]
#用户组
@developer = rw
#单个用户
tony = rw
#段名为"[/foo/bar]"的版本库路径权限段设置了所有引用该权限配置文件的版本库中目录"/foo/bar"的访问权限
# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

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
# 口令配置格式:用户名 = 口令
# 口令为未经过任何处理的明文
tony = 123456
kaka = 123456
aiai = 123456

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.apache.org/ for more information.

[general]
### The anon-access and auth-access options control access to the
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete 
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
# anon-access = read
# 非鉴权用户无权限访问该版本库
anon-access = none
# 鉴权用户可对版本库进行读写
anon-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
# 版本库的认证域,此处任意写,有意义的
realm = /home/svn/repository
### The force-username-case option causes svnserve to case-normalize
### usernames before comparing them against the authorization rules in the
### authz-db file configured above.  Valid values are "upper" (to upper-
### case the usernames), "lower" (to lowercase the usernames), and
### "none" (to compare usernames as-is without case conversion, which
### is the default behavior).
# force-username-case = none

[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

参数和目录结构说明:

[root@CentOS-Slave1 repository]# pwd
/home/svn/repository
[root@CentOS-Slave1 repository]# ll
total 20
drwxr-xr-x. 2 root root 4096 Oct 18 13:55 conf
drwxr-sr-x. 6 root root 4096 Oct 18 14:07 db
-r--r--r--. 1 root root    2 Oct 18 12:21 format
drwxr-xr-x. 2 root root 4096 Oct 18 12:21 hooks
drwxr-xr-x. 2 root root   39 Oct 18 12:21 locks
-rw-r--r--. 1 root root  229 Oct 18 12:21 README.txt
conf 目录 存放版本库(用户权限/)所用配置文件的目录 
dav 目录 供mod_dav_svn使用 
db 目录 版本数据存储目录 
db/fs-type 文件 版本库数据真实存储格式,SVN有fsfs和bdb两种存储格式 
db/revprops 目录 记录版本属性 
db/revs 目录 版本库数据存储真实目录 
db/uuid 文件 存储版本库唯一标识号
db/txn-current 文件 记录当前事务 
format 文件 存储一个整数的文件,此整数代表库层次结构版本 
hooks 目录 存放版本库勾子目录 
locks 目录 存储库锁目录,用来跟踪库的访问者 
root@CentOS-Slave1 conf]# ll
total 24
rw-r--r-- 1 root root 1092 Sep 23 21:31 authz
-rw-r--r-- 1 root root  322 Sep 23 21:31 passwd
-rw-r--r-- 1 root root 2326 Sep 23 21:27 svnserve.conf
svnserve配置文件svn仓库下的conf下的3个文本文件组成:
svnserve.conf:svn服务配置文件
passwd:用户名口令文件,该文件名在文件svnserve.conf中指定,缺省为同目录下的
authz:权限配置文件,该文件名也在文件svnserve.conf中指定,缺省为同目录下的

svnserve.conf下由一个[general]配置段组成,[general]配置段中配置行格式:配置项 = 值

    anon-access  控制非鉴权用户访问版本库的权限。取值范围为"write"、"read"和"none"。
                 即"write"为可读可写,"read"为只读,"none"表示无访问权限。
                 缺省值:read
    auth-access  控制鉴权用户访问版本库的权限。取值范围为"write"、"read"和"none"。
                 即"write"为可读可写,"read"为只读,"none"表示无访问权限。
                 缺省值:write

    password-db  指定用户名口令文件名。除非指定绝对路径,否则文件位置为相对conf
                 目录的相对路径。
                 缺省值:passwd

    authz-db     指定权限配置文件名,通过该文件可以实现以路径为基础的访问控制。
                 除非指定绝对路径,否则文件位置为相对conf目录的相对路径。
                 缺省值:authz
				 绝对路径:http://www.timespacexstar.com/conf/authz
				 
    realm        指定版本库的认证域,即在登录时提示的认证域名称。若两个版本库的
                 认证域相同,建议使用相同的用户名口令数据文件。
                 缺省值:一个UUID(Universal Unique IDentifier,全局唯一标示)。
注:svnserve服务有效:对客户端通过前缀为svn://或svn+ssh://的URL访问版本库有效,对通过前缀http://、https://或 file:///的URL无效.

eclipse插件地址:

Links for 1.8.x Release: 
Name:Subclipse
Eclipse update site URL: http://subclipse.tigris.org/update_1.8.x 
svn插件包下载: http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240 

Links for 1.6.x Release: 
Eclipse update site URL: http://subclipse.tigris.org/update_1.6.x 
svn插件包下载: http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240 

Links for 1.4.x Release: 
Eclipse update site URL: http://subclipse.tigris.org/update_1.4.x 
svn插件包下载: http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240 


目录
相关文章
|
13天前
|
Linux 网络安全 开发工具
Centos6.5安装并配置Telnet服务
该内容是一个关于如何安装配置Telnet服务的教程。首先,通过yum安装vim、xinetd、telnet和telnet-server。接着,修改/etc/xinetd.d/telnet配置文件,将disable改为no,并设置访问限制(如限定特定网段和时间)。关闭防火墙,重启服务。创建测试用户后,分别使用CentOS和Windows的Telnet客户端进行连接测试,显示成功,实验完成。
21 1
|
5天前
|
运维 安全 Linux
如何在CentOS7一键安装宝塔面板并实现固定地址访问内网宝塔进行管理
如何在CentOS7一键安装宝塔面板并实现固定地址访问内网宝塔进行管理
|
5天前
|
Linux 测试技术 数据安全/隐私保护
CentOS安装MeterSphere并实现无公网IP远程访问本地测试平台
CentOS安装MeterSphere并实现无公网IP远程访问本地测试平台
|
6天前
|
Linux Docker 容器
centos7安装docker图文详解
该文档提供了在CentOS上安装Docker的步骤:检查系统内核版本(需大于3.10),更新yum,卸载旧版Docker,安装yum-utils和依赖包,设置Docker仓库,列出并选择Docker版本,安装Docker,最后启动并设置Docker开机启动,通过`docker version`验证安装是否成功。
|
7天前
|
关系型数据库 MySQL 应用服务中间件
centos7在线安装jdk1.8+tomcat+mysql8+nginx+docker
现在,你已经成功在CentOS 7上安装了JDK 1.8、Tomcat、MySQL 8、Nginx和Docker。你可以根据需要配置和使用这些服务。请注意,安装和配置这些服务的详细设置取决于你的具体需求。
25 2
|
8天前
|
NoSQL Linux 网络安全
【专栏】如何在 RHEL 8 或者 CentOS 8 上安装 MongoDB?
【4月更文挑战第28天】本文档介绍了如何在RHEL或CentOS 8上安装MongoDB,包括环境准备(系统更新、依赖安装、硬件需求和sudo用户)、导入MongoDB GPG公钥、创建Yum仓库、安装MongoDB社区版,以及后续的基本配置和验证(启动服务、防火墙设置和连接验证)。通过这些步骤,用户可以顺利安装并运行MongoDB,以处理非结构化数据和扩展技术栈。
|
8天前
|
安全 Linux 网络安全
【专栏】如何进行 CentOS 8 最小安装
【4月更文挑战第28天】本文介绍了如何进行CentOS 8的最小安装,包括准备工作(确认硬件兼容性、下载ISO镜像、制作启动盘及备份数据)和安装步骤(选择语言、最小环境、网络设置、安全策略、分区、用户设置及开始安装)。安装后需进行基础配置,如系统更新、SELinux设置、防火墙配置、安装必要软件包和服务优化。最小安装提供了一个精简高效的环境,便于用户根据需求自定义和管理服务器。
|
10天前
|
存储 Linux 持续交付
【docker】CentOS 7上安装Docker的详细过程
【docker】CentOS 7上安装Docker的详细过程
|
12天前
|
安全 关系型数据库 Linux
centos7_安装mysql8(局域网访问navicat连接)
centos7_安装mysql8(局域网访问navicat连接)
18 1
|
12天前
|
Linux 云计算 Perl
centos7_安装虚拟机工具
centos7_安装虚拟机工具
20 0

热门文章

最新文章