CentOS7 搭建 SVN 服务器

介绍SVN:

SVN是Subversion的简称,是一个开放源代码的版本控制系统,相较于RCS、CVS,它采用了分支管理系统,它的设计目标就是取代CVS。互联网上很多版本控制服务已从CVS迁移到Subversion。说得简单一点SVN就是用于多个人共同开发同一个项目,共用资源的目的。

安装SVN:

[root@centos7 ~]#
[root@centos7 ~]# yum install -y subversion
出现如下问题:
[root@centos7 ~]#
[root@centos7 ~]# yum install -y subversion
已加载插件:fastestmirror, langpacks
/var/run/yum.pid 已被锁定,PID 为 4137 的另一个程序正在运行。
Another app is currently holding the yum lock; waiting for it to exit...
另一个应用程序是:PackageKit
内存: 99 M RSS (502 MB VSZ)
已启动: Fri Mar 22 18:57:37 2019 - 00:52之前
状态 :睡眠中,进程ID:4137
Another app is currently holding the yum lock; waiting for it to exit...
另一个应用程序是:PackageKit
内存: 99 M RSS (502 MB VSZ)
已启动: Fri Mar 22 18:57:37 2019 - 00:54之前
状态 :睡眠中,进程ID:4137
原因:
这是因为yum处于锁定状态中。可以通过强制关掉yum进程来解决这个问题,直接在终端运行 rm -f /var/run/yum.pid 将该文件删除,然后再次运行yum即可。
解决方法:
[root@centos7 ~]# sudo rm -rf /var/run/yum.pid
[root@centos7 ~]#

创建一个存储 SVN 的目录

新建一个目录用于存储SVN目录、一般存放在 /var/local/

[root@centos7 ~]# cd /usr/local/
[root@centos7 local]
[root@centos7 local]# mkdir svn

新建一个测试仓库

[root@centos7 local]# cd svn/
[root@centos7 svn]# svnadmin create test

然后查看当前目录下、会发现多了一个 test 文件夹、然后进入到 test 下。

[root@centos7 svn]#
[root@centos7 svn]# ll
# 总用量 4
# drwxr-xr-x. 6 root root 4096 3月 22 21:13 test
[root@centos7 svn]# cd test/
[root@centos7 test]# ll
# 总用量 24
# drwxr-xr-x. 2 root root 4096 3月 22 21:13 conf
# drwxr-sr-x. 6 root root 4096 3月 22 21:13 db
# -r--r--r--. 1 root root 2 3月 22 21:13 format
# drwxr-xr-x. 2 root root 4096 3月 22 21:13 hooks
# drwxr-xr-x. 2 root root 4096 3月 22 21:13 locks
# -rw-r--r--. 1 root root 229 3月 22 21:13 README.txt
[root@centos7 test]#

以下关于目录的说明:

conf目录:  是这个仓库配置文件(仓库用户访问账户,权限)
format目录:是一个文本文件,里边只放了一个整数,表示当前文件库配置的版本号
hooks目录: 放置hook脚步文件的目录
locks目录: 用来放置subversion的db锁文件和db_logs锁文件的目录,用来追踪存取文件库的客户端

配置测试仓库

[root@centos7 test]#
[root@centos7 test]# cd conf/
[root@centos7 conf]# ll
# 总用量 12
# -rw-r--r--. 1 root root 1080 3月 22 21:13 authz
# -rw-r--r--. 1 root root 309 3月 22 21:13 passwd
# -rw-r--r--. 1 root root 3090 3月 22 21:13 svnserve.conf
1、修改SVN服务的配置文件svnserver.conf
[root@centos7 conf]# vim svnserve.conf
# 修改四处
# 分别为 19、20、27、34行
具体如下:
1 ### This file controls the configuration of the svnserve daemon, if you
2 ### use it to allow access to this repository. (If you only allow
3 ### access through http: and/or file: URLs, then this file is
4 ### irrelevant.)
5
6 ### Visit http://subversion.apache.org/ for more information.
7
8 [general]
9 ### The anon-access and auth-access options control access to the
10 ### repository for unauthenticated (a.k.a. anonymous) users and
11 ### authenticated users, respectively.
12 ### Valid values are "write", "read", and "none".
13 ### Setting the value to "none" prohibits both reading and writing;
14 ### "read" allows read-only access, and "write" allows complete
15 ### read/write access to the repository.
16 ### The sample settings below are the defaults and specify that anonymous
17 ### users have read-only access to the repository, while authenticated
18 ### users have read and write access to the repository.
19 anon-access = read ##注意前边不要有空格,要顶齐
20 auth-access = write ##注意前边不要有空格,要顶齐
21 ### The password-db option controls the location of the password
22 ### database file. Unless you specify a path starting with a /,
23 ### the file's location is relative to the directory containing
24 ### this configuration file.
25 ### If SASL is enabled (see below), this file will NOT be used.
26 ### Uncomment the line below to use the default password file.
27 password-db = passwd ##注意前边不要有空格,要顶齐
28 ### The authz-db option controls the location of the authorization
29 ### rules for path-based access control. Unless you specify a path
30 ### starting with a /, the file's location is relative to the the
31 ### directory containing this file. If you don't specify an
32 ### authz-db, no path-based access control is done.
33 ### Uncomment the line below to use the default authorization file.
34 authz-db = authz ##注意前边不要有空格,要顶齐
35 ### This option specifies the authentication realm of the repository.
36 ### If two repositories have the same authentication realm, they should
37 ### have the same password database, and vice versa. The default realm
38 ### is repository's uuid.
39 # realm = My First Repository
40 ### The force-username-case option causes svnserve to case-normalize
41 ### usernames before comparing them against the authorization rules in the
42 ### authz-db file configured above. Valid values are "upper" (to upper-
43 ### case the usernames), "lower" (to lowercase the usernames), and
44 ### "none" (to compare usernames as-is without case conversion, which
45 ### is the default behavior).
46 # force-username-case = none
2、配置访问用户及密码
[root@centos7 conf]#
[root@centos7 conf]# vim passwd
# 按内容中已知的规则添加用户密码
具体如下:
1 ### This file is an example password file for svnserve.
2 ### Its format is similar to that of svnserve.conf. As shown in the
3 ### example below it contains one section labelled [users].
4 ### The name and password for each user follow, one account per line.
5
6 [users]
7 # harry = harryssecret
8 # sally = sallyssecret
9 root = root
10 test1 = test
11 test2 = test
3、配置新用户的授权文件
[root@centos7 conf]#
[root@centos7 conf]# vim authz
具体如下:
1 ### This file is an example authorization file for svnserve.
2 ### Its format is identical to that of mod_authz_svn authorization
3 ### files.
4 ### As shown below each section defines authorizations for the path and
5 ### (optional) repository specified by the section name.
6 ### The authorizations follow. An authorization line can refer to:
7 ### - a single user,
8 ### - a group of users defined in a special [groups] section,
9 ### - an alias defined in a special [aliases] section,
10 ### - all authenticated users, using the '$authenticated' token,
11 ### - only anonymous users, using the '$anonymous' token,
12 ### - anyone, using the '*' wildcard.
13 ###
14 ### A match can be inverted by prefixing the rule with '~'. Rules can
15 ### grant read ('r') access, read-write ('rw') access, or no access
16 ### ('').
17
18 [aliases]
19 # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
20
21 [groups]
22 # harry_and_sally = harry,sally
23 # harry_sally_and_joe = harry,sally,&joe
24
25 # [/foo/bar]
26 # harry = rw
27 # &joe = r
28 # * =
29
30 # [repository:/baz/fuz]
31 # @harry_and_sally = rw
32 # * = r
33
34 admin = root,test1
35 user = test2
36 [/svn/test]
37 @admin = rw
38 @user = r
39 * =
备注:
admin = root,test1 # 创建admin组,组成员为:root,test1
user = test2 # 创建用户组,用户成员:test2
[/svn/test] # 赋予根权限,为了便于管理和权限的控制,可以把权限细化到版本库中相应的目录
@admin = rw # admin组有读写的权限
@user = r # user组只有读的权限
*= # 表示除了上面设置的权限用户组以外,其他所有用户都设置空权限,空权限表示禁止访问本目录,这很重要一定要加上。

启动svn服务

[root@centos7 conf]# svnserve -d -r /usr/local/svn/
[root@centos7 conf]#
# 没有出错边是成功、如果出现以下错误、则需先关闭kill进程、然后重新启动。
# 具体操作如下:
[root@centos7 conf]# svnserve -d -r /usr/local/svn/
# svnserve: E000098: 不能绑定服务器套接字: 地址已在使用
[root@centos7 conf]#
[root@centos7 conf]# ps aux | grep svn
# root 8682 0.0 0.0 199280 1028 ? Ss 09:29 0:00 svnserve -d -r /usr/local/svn/
# root 24448 0.0 0.0 112656 968 pts/1 S+ 09:31 0:00 grep --color=auto svn
[root@centos7 conf]#
[root@centos7 conf]# kill 8682
[root@centos7 conf]# ps aux | grep svn
# root 24507 0.0 0.0 112656 968 pts/1 S+ 09:32 0:00 grep --color=auto svn
[root@centos7 conf]#
[root@centos7 conf]# svnserve -d -r /usr/local/svn/
[root@centos7 conf]#

CentOS7 搭建 SVN 服务器的更多相关文章

  1. centos7搭建svn服务器及客户端设置

    centos7搭建svn服务器及客户端设置 centos7貌似预装了svn服务(有待确认),因此我们直接启动该服务即可 一.svn服务端配置(服务器IP假设为192.168.100.1) 步骤1:创建 ...

  2. centos7 搭建svn服务器&客户端的访问&备份迁移

    当今用于版本控制的软件程序主要的有svn和git,其它软件咱不熟悉,今天记录下搭建svn服务器和svn客户端使用: 使用环境:虚拟机为centos7系统,svn服务器安装在centos7系统平台上,s ...

  3. centos7 搭建svn服务器

    1.安装svn服务器: yum install subversion 2.配置svn服务器: 建立svn版本库根目录及相关目录即svndata及密码权限命令svnpasswd: mkdir -p /a ...

  4. centos7搭建svn服务器并支持http方式访问

    因为公司其他人员需要,需要在服务器上搭建svn服务,途中遇到不少问题,做下记录 第一步,安装svn 默认centos7是已经安装了svn即subversion 检查是否安装 rpm -qa subve ...

  5. CentOS7搭建SVN服务器

    首先,你得有个VPS,我用的是搬瓦工. 安装步骤如下:1.yum install subversion2.查看安装版本 svnserve --version   3.创建SVN版本库目录 mkdir ...

  6. centos7下SVN服务器如何搭建

    Centos7 搭建svn服务器 linux(centos)下SVN服务器如何搭建?说到SVN服务器,想必大家都知道,可以是在LINUX下如何搭建SVN服务器呢?那么今天给大家分享一下linux(ce ...

  7. 【SVN】CentOS7.0下搭建SVN服务器

    SVN服务器搭建 最近接手了天赋吉运的SVN项目管理,那么学会搭建SVN服务器就成为了必须的技能.这篇文章就来讲一讲在CentOS7.0下如何搭建SVN服务器 1,下载安装SVN版本 yum inst ...

  8. centos7.3给搭建SVN服务器

    centos7.3给搭建SVN服务器 1 安装svnserver yum install subversion 2 查看版本 svnserve --version 3 创建版本库 3.1 运行以下命令 ...

  9. centos7搭建SVN并配置使用http方式访问SVN服务器

    一.检查SVN是否安装 centos7系统自带SVN # rpm -qa subversion [root@localhost ~]# rpm -qa subversion subversion--. ...

随机推荐

  1. 安装openssh

    在推进ansible用于配置管理与自动部署,其中一个很困扰的问题是创建ssh通道很慢,虽然ansible在同一个task里面是并行的控制多台受控端.但是每一个task都需要和受控端创建ssh通道,非常 ...

  2. 关于freemarker 空变量的接收以及类型转换 笔记

    通常接收一个变量是${siOrganid},如果并没有这个变量,是这么处理${siOrganid!},如果这个变量是某个类属性,是这么处理${interfsrv.siOrganid!},如果这个类也是 ...

  3. 终于开始我的java旅程了!

    首先今天先装了jdk1.7 ,找了半天,因为官网是都是让你装1.8的最新版本,地址如下: 所有jdk的历史版本: http://www.oracle.com/technetwork/java/java ...

  4. golang channel

    ex1 package main /* goroutine 是由GO运行时管理的轻量级线程 go f(x,y, z) 就启动了一个goroutine, 其中f,x,y,z在当前goroutine中立即 ...

  5. 非对称加密, 助记词, PIN, WIF

    一钱包 1.1非对称加密, 助记词, PIN, WIF, 地址 1.1.1 非对称加密算法 非对称加密算法, 加密与解密使用不同的KEY, 我们分别称为私钥与公钥,其中可以通过私钥生成公钥 在比特币中 ...

  6. 【软件安装与环境配置】ubuntu16.04+caffe+nvidia+CUDA+cuDNN安装配置

    前言 博主想使用caffe框架进行深度学习相关网络的训练和测试,刚开始做,特此记录学习过程. 环境配置方面,博主以为最容易卡壳的是GPU的NVIDIA驱动的安装和CUDA的安装,前者尝试的都要吐了,可 ...

  7. chm提取

    Python读写CHM文件 7z 可以将chm解包为HTML

  8. 20155219付颖卓《网络对抗》EXP7网络欺诈技术防范

    实验后回答问题 1.通常在什么场景下容易受到DNS spoof攻击 在公共共享网络里,并且同一网段可以ping通的网络非常容易被攻击. 2.在日常生活工作中如何防范以上两攻击方法 不在不信任的公开网络 ...

  9. 湖南大学第十四届ACM程序设计新生杯(重现赛)I:II play with GG(博弈论||DP)

    链接:https://ac.nowcoder.com/acm/contest/338/I 来源:牛客网 题目描述 IG won the S championship and many people a ...

  10. PXE高效能批量网络装机

    PXE简绍 PXE(preboot execute environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器 ...