CentOS 7下搭建配置SVN服务器

1. 安装

CentOS通过yum安装subversion。

$ sudo yum install subversion

subversion安装在/bin目录:

$ which svnserve
/bin/svnserve

检查一下subversion是否安装成功。

$ svnserve --version
svnserve, version 1.7.14 (r1542130)
  compiled Nov 20 2015, 19:25:09

Copyright (C) 2013 The Apache Software Foundation.
This software consists of contributions made by many people; see the NOTICE
file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository back-end (FS) modules are available:

* fs_base : Module for working with a Berkeley DB repository.
* fs_fs : Module for working with a plain file (FSFS) repository.

Cyrus SASL authentication is available.

2. 建立版本库

subversion默认以/var/svn作为数据根目录,可以通过/etc/sysconfig/svnserve修改这个默认位置。

$ systemctl cat svnserve.service
# /usr/lib/systemd/system/svnserve.service
[Unit]
Description=Subversion protocol daemon
After=syslog.target network.target

[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/svnserve
ExecStart=/usr/bin/svnserve --daemon --pid-file=/run/svnserve/svnserve.pid $OPTIONS

[Install]
WantedBy=multi-user.target

$ cat /etc/sysconfig/svnserve
# OPTIONS is used to pass command-line arguments to svnserve.

# Specify the repository location in -r parameter:
OPTIONS="-r /var/svn"

我们修改/etc/sysconfig/svnserver将默认目录指定到/opt/svn。

$ cat /etc/sysconfig/svnserve
OPTIONS="-r /opt/svn"

使用svnadmin建立版本库spring-hello-world。

$ sudo mkdir -p /opt/svn
$ sudo svnadmin create /opt/svn/spring-hello-world

$ ll /opt/svn/
drwxr-xr-x. 6 root root 80 Nov 10 14:42 spring-hello-world

$ ll /opt/svn/spring-hello-world/
drwxr-xr-x. 2 root root  51 Nov 10 14:42 conf
drwxr-sr-x. 6 root root 4096 Nov 10 14:42 db
-r--r--r--. 1 root root    2 Nov 10 14:42 format
drwxr-xr-x. 2 root root 4096 Nov 10 14:42 hooks
drwxr-xr-x. 2 root root  39 Nov 10 14:42 locks
-rw-r--r--. 1 root root  229 Nov 10 14:42 README.txt

3. 配置

编辑用户文件passwd,新增两个用户:admin和guest。

$ cat /opt/svn/spring-hello-world/conf/passwd
[users]
admin = admin
guest = guest

编辑权限文件authz,用户admin设置可读写权限,guest设置只读权限。

$ cat /opt/svn/spring-hello-world/conf/authz
[/]
admin = rw
guest = r

编辑svnserve.conf:

$ cat /opt/svn/spring-hello-world/conf/svnserve.conf
[general]
anon-access = none #控制非鉴权用户访问版本库的权限
auth-access = write #控制鉴权用户访问版本库的权限
password-db = passwd #指定用户名口令文件名
authz-db = authz #指定权限配置文件名
realm = spring-hello-world #指定版本库的认证域,即在登录时提示的认证域名称

4. SVN服务

启动SVN服务。

$ sudo systemctl start svnserve.service

检查服务是否启动成功。

$ ps aux | grep svn
root 16349 0.0 0.1 162180 900 ? Ss 15:01 0:00 /usr/bin/svnserve --daemon --pid-file=/run/svnserve/svnserve.pid -r /opt/svn

通过netstat可以看到SVN打开了3690端口。

$ sudo netstat -tnlp
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 16349/svnserve

设置成开机启动。

$ sudo systemctl enable svnserve.service

5. 客户端测试

客户端可以通过TortoriseSVN测试。

这时候可能会防火墙问题。如果是防火墙问题,会提示无法连接。

客户端用telnet无法连接。

C:\Temp>telnet 192.168.12.59 360

用systemctl检查服务器的防火墙配置:

$ firewall-cmd --list-all
public (default, active)
interfaces: eno16777736 eno33554984
sources:
services: dhcpv6-client ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:

可以看到,没有telnet服务和3690端口。增加telnet服务器和3690端口:

$ sudo firewall-cmd --permanent --add-service=telnet
$ sudo firewall-cmd --permanent --add-port=3690/tcp
$ sudo firewall-cmd --reload

客户端再用telnet,应该就可以了。

CentOS 7下搭建配置SVN服务器的更多相关文章

  1. CentOS 7下搭建配置 SVN 服务器

    原文链接:https://www.cnblogs.com/tdalcn/p/6937714.html 同步:http://blog.csdn.net/u011884440/article/detail ...

  2. 阿里云服务器centos下安装配置svn服务器

      阿里云服务器centos下安装配置svn服务器 1.安装svn服务器端yum install subversion      从镜像下载安装svn服务器端中间会提示是否ok,输入y,确认安装成功提 ...

  3. Windows下搭建本地SVN服务器【转】

    转自:http://www.linuxidc.com/Linux/2015-01/111563.htm 本文介绍Windows下搭建本地SVN服务器的方法,网上资料比较少也比较旧,大都介绍的是旧版本S ...

  4. linux下安装配置svn服务器

    linux下安装配置svn服务器 1. svn服务器安装 将subversion-1.4.0.tar.gz和subversion-deps-1.4.0.tar.gz传到服务器. tar xfvz su ...

  5. CentOS 7.2 x64 配置SVN服务器

    说明: SVN(subversion)的运行方式有两种: 一种是基于Apache的http.https网页访问形式,还有一种是基于svnserve的独立服务器模式. SVN的数据存储方式也有两种:一种 ...

  6. CentOS下安装配置SVN服务器并自动同步到web目录

    一.安装 yum install subversion测试是否安装成功 /usr/bin/svnserve --version如提示以下内容,说明已安装成功 svnserve,版本 1.6.11 (r ...

  7. CentOS7搭建配置SVN服务器

    安装subversionyum install subversionsubversion安装在/bin目录检查一下subversion是否安装成功svnserve --version 建立版本库sub ...

  8. CentOS7:搭建配置SVN服务器

    1. 安装 CentOS通过yum安装subversion. $ sudo yum install subversion subversion安装在/bin目录: $ which svnserve / ...

  9. Centos apache + mysql + usvn 配置svn 服务器

    1.遇到问题 提交异常:'svn/!svn/me'path not found http://www.myexception.cn/cvs-svn/1262826.html 更改http.conf 配 ...

随机推荐

  1. 使用IntelliJ IDEA进行Python远程调试的需求(未完)

    使用IntelliJ IDEA进行Python远程调试的需求(未完) 在研究深度学习Machlearning时,有时候需要借助ubuntu搭建的tensorflow环境,另外也有越来越多的运算程序只能 ...

  2. POJ 1556 - The Doors - [平面几何+建图spfa最短路]

    题目链接:http://poj.org/problem?id=1556 Time Limit: 1000MS Memory Limit: 10000K Description You are to f ...

  3. POJ 2195 - Going Home - [最小费用最大流][MCMF模板]

    题目链接:http://poj.org/problem?id=2195 Time Limit: 1000MS Memory Limit: 65536K Description On a grid ma ...

  4. Xcode 9运行h d f报错

    SocialSDKXib/UMSCommentInputController.xib: error: Illegal Configuration: Compiling IB documents for ...

  5. IDEA 配置环境和相关工具整理(新手入门)

    转载自:https://blog.csdn.net/moneyshi/article/details/79722360 因项目环境需要,开发工具需要统一 , 项目团队都使用idea,所以不得已自己也配 ...

  6. 2018/04/21 PHP 中的Session和Cookie知识总结

    在之后的工作和学习中,更是发现了自己对于基础知识的不扎实,于是又返回头来学习,确实很多东西是之前没注意或是没掌握的. 着重讲一下这几个问题 -- 什么是 Cookie ? 简单来说: 因为 HTTP ...

  7. gulp自动化部署:gulp发布express项目(二)

    原文:https://my.oschina.net/songzhu/blog/610337 一.服务器准备 服务器ip地址为:172.16.70.174 1.安装 Node.js 参考:http:// ...

  8. CentOS 7显卡驱动问题

    CentOS 7 KDE桌面安装后有时会出现nouveau 驱动问题,导致系统不定时死机或者重启,那么这时只能禁用nouveau 1. 在配置文件中禁用nouveauvi /etc/modprobe. ...

  9. redis连接池的标准用法:

    from .conf import HOST, PORT, POOL_NAME import redis redis_pool = redis.ConnectionPool(host=HOST, po ...

  10. Ultra-QuickSort(poj 2299归并排序)

    http://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=232#problem/A B - Ultra-QuickSort Time Li ...