目录

  • 前言
  • 通过yum源安装subversion 和 mod_dav_svn
    • 检查subversion是否安装成功
    • 检查apache是否安装成功
    • apache无法启动错误:Address already in use
  • 配置mod_dav_svn
    • 新增 subversion.conf.inc 文件
    • 新增 VirtualHost
    • htpasswd 文件
    • 新增 authz.conf 文件
    • apache reload
    • 新建SVN仓库
    • 访问
    • svn commit 错误:could not begin a transaction
    • 关于 Satisfy
  • 参考

前言

  • OS: CentOS Linux release 7.9.2009 (Core)

通过yum源安装subversion 和 mod_dav_svn

shell> yum install subversion
shell> yum install mod_dav_svn
  • 通过yum源安装的subversion,既包含服务端,又包含客户端。
  • 通过yum源安装的mod_dav_svn,是个带了mod_dav、mod_dav_svn、mod_authz_svn的apache。

检查subversion是否安装成功

shell> svn --version
svn, version 1.10.2 (r1835932)compiled Feb 22 2021, 05:02:40 on x86_64-redhat-linux-gnuCopyright (C) 2018 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 access (RA) modules are available:* ra_svn : Module for accessing a repository using the svn network protocol.- with Cyrus SASL authentication- handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.- handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.- using serf 1.3.9 (compiled with 1.3.9)- handles 'http' scheme- handles 'https' schemeThe following authentication credential caches are available:* Plaintext cache in /root/.subversion
* Gnome Keyring
* GPG-Agent

检查apache是否安装成功

尝试启动apache,如果能够启动成功,就表示apache安装成功。

  1. 查看apache版本
shell> httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Mar 24 2022 14:57:57
  1. 启动 apache
shell> systemctl start httpd
  1. 查看 apache 的运行状态,其状态为Active: active (running)时,表示apache已启动成功。
shell> systemctl status httpd
● httpd.service - The Apache HTTP ServerLoaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)Active: active (running) since Sun 2022-09-04 10:55:17 CST; 1s agoDocs: man:httpd(8)man:apachectl(8)Main PID: 25818 (httpd)Status: "Processing requests..."Tasks: 6Memory: 3.0MCGroup: /system.slice/httpd.service├─25818 /usr/sbin/httpd -DFOREGROUND├─25819 /usr/sbin/httpd -DFOREGROUND├─25820 /usr/sbin/httpd -DFOREGROUND├─25821 /usr/sbin/httpd -DFOREGROUND├─25822 /usr/sbin/httpd -DFOREGROUND└─25823 /usr/sbin/httpd -DFOREGROUNDSep 04 10:55:17 tencent-test-02 systemd[1]: Starting The Apache HTTP Server...
Sep 04 10:55:17 tencent-test-02 httpd[25818]: AH00558: httpd: Could not reliably determine the server's fully q...ssage
Sep 04 10:55:17 tencent-test-02 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
  1. 还可以通过浏览器访问 apache,查看其提供的默认网页

    注意:不同版本的apache提供的默认网页是不一样的。

apache无法启动错误:Address already in use

apache无法启动,查看日志,发现错误为Address already in use

shell> systemctl start httpd
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.shell> systemctl status httpd.service
● httpd.service - The Apache HTTP ServerLoaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)Active: failed (Result: exit-code) since Sun 2022-09-04 10:57:01 CST; 1min 6s agoDocs: man:httpd(8)man:apachectl(8)Process: 26171 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)Main PID: 26171 (code=exited, status=1/FAILURE)Sep 04 10:57:01 tencent-test-02 systemd[1]: Starting The Apache HTTP Server...
Sep 04 10:57:01 tencent-test-02 httpd[26171]: AH00558: httpd: Could not reliably determine the server's fully q...ssage
Sep 04 10:57:01 tencent-test-02 httpd[26171]: (98)Address already in use: AH00072: make_sock: could not bind to...:]:80
Sep 04 10:57:01 tencent-test-02 httpd[26171]: (98)Address already in use: AH00072: make_sock: could not bind to....0:80
Sep 04 10:57:01 tencent-test-02 httpd[26171]: no listening sockets available, shutting down
Sep 04 10:57:01 tencent-test-02 httpd[26171]: AH00015: Unable to open logs
Sep 04 10:57:01 tencent-test-02 systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Sep 04 10:57:01 tencent-test-02 systemd[1]: Failed to start The Apache HTTP Server.
Sep 04 10:57:01 tencent-test-02 systemd[1]: Unit httpd.service entered failed state.
Sep 04 10:57:01 tencent-test-02 systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

错误为Address already in use时,有两个解决办法:

  • 方法1:找到占用80端口的程序,kill掉该程序,然后再启动apache即可。
  • 方法2:更换个端口(不用80端口了)。

配置mod_dav_svn

能看懂英文的,参考这里:

  • https://svnbook.red-bean.com/en/1.1/ch06s04.html
  • https://svnbook.red-bean.com/en/1.7/svn.serverconfig.httpd.html

新增 subversion.conf.inc 文件

/etc/httpd/conf.d 目录下,新增 subversion.conf.inc 文件:

shell> cd /etc/httpd/conf.d
shell> vim subversion.conf.inc

subversion.conf.inc 文件内容:

# 所有请求都要求先登录
<Location /># 认证类型为基本认证# 认证类型为基本认证时,未登录的情况下,将在浏览器中弹出一个认证(登录)对话框。AuthType Basic# 认证名称。 认证对话框的标题# 在认证对话框中输入用户名和密码AuthName "Subversion Repository"# 认证功能使用的、保持用户名和密码的文件AuthUserFile /home/svn/htpasswd# 要求验证用户(即:不能匿名访问)Require valid-user
</Location>
# svn 配置
<Location /svn/>DAV svn # 如果只有一个SVN仓库,使用该选项# SVNPath /absolute/path/to/repository# 如果有多个SVN仓库,使用该选项SVNParentPath /home/svn# 打开这个选项可以列出ParentPath下面的所有库。取值: on/offSVNListParentPath off# 所有仓库共用一个访问权限配置文件AuthzSVNAccessFile /home/svn/authz.conf# 每个仓库一个访问权限配置文件。仓库目录/conf/authz.conf# AuthzSVNReposRelativeAccessFile authz.conf
</Location>
  • 从 Subversion 1.7 开始, 还可以用 配置指令 AuthzSVNReposRelativeAccessFile 指定 每个仓库各自的访问权限配置文件.

新增 VirtualHost

/etc/httpd/conf.d 目录下,新增 subversion_vhost.conf 文件:

shell> cd /etc/httpd/conf.d
shell> vim subversion_vhost.conf

不启用HTTPS时,subversion_vhost.conf 文件内容:

<VirtualHost xxx.xxx.xxx.xxx:80>DocumentRoot "/var/www/empty/html_ssl"ServerName xxx.xxx.com<LocationMatch ".*">ErrorDocument 403 "<H1>403</H1><p>https</p>"ErrorDocument 404 "<H1>404</H1><p>https</p>"RewriteEngine OnRewriteRule "/svn" "-" [END]RewriteRule "/svn/.*" "-" [END]RewriteRule ".*" "-" [R=404]</LocationMatch>Include conf.d/subversion.conf.inc
</VirtualHost>

启用HTTPS时,subversion_vhost.conf 文件内容:

<VirtualHost xxx.xxx.xxx.xxx:443>DocumentRoot "/var/www/empty/html_ssl"ServerName xxx.xxx.comSSLEngine onSSLCertificateFile /etc/httpd/cert.d/com.xxx.xxx.certSSLCertificateKeyFile /etc/httpd/cert.d/com.xxx.xxx.keySSLCertificateChainFile /etc/httpd/cert.d/cacert.pem<LocationMatch ".*">ErrorDocument 403 "<H1>403</H1><p>https</p>"ErrorDocument 404 "<H1>404</H1><p>https</p>"RewriteEngine OnRewriteRule "/svn" "-" [END]RewriteRule "/svn/.*" "-" [END]RewriteRule ".*" "-" [R=404]</LocationMatch>Include conf.d/subversion.conf.inc
</VirtualHost>
  • 443端口为https

htpasswd 文件

不存在htpasswd 文件,增加用户:

shell> htpasswd -cm /home/svn/htpasswd jack
New password: *****
Re-type new password: *****
Adding password for user jack
  • subversion.passwd文件不存在时, htpasswd 命令中添加 -c 选项会创建文件。
  • htpasswd 命令中使用 -m 选项时,使用 MD5 加密密码。

已存在htpasswd 文件,增加用户:

shell> htpasswd -m /home/svn/htpasswd rose
New password: *******
Re-type new password: *******
Adding password for user rose
  • htpasswd 命令中使用 -m 选项时,使用 MD5 加密密码。

修改密码:

shell> htpasswd -m /home/svn/htpasswd jack
New password: *****
Re-type new password: *****
Adding password for user jack

删除用户:

shell> htpasswd -D /home/svn/htpasswd jack

新增 authz.conf 文件

参考这里:https://svnbook.red-bean.com/en/1.7/svn.serverconfig.pathbasedauthz.html

/home/svn/ 目录下,新增 authz.conf 文件:

shell> cd /home/svn
shell> vim authz.conf

authz 文件内容:

[test:/]
rose=r
jack=rw

名为test的svn仓库,rose有read权限,jack有read和write权限。

apache reload

shell> systemctl reload httpd

新建SVN仓库

shell> svnadmin create /home/svn/test
shell> chown -R apache /home/svn/test
  • 修改/home/svn/test目录的所有者为apache

访问


修改subversion.authz 文件内容:

[test:/]
rose=
jack=rw

apache reload后,再次访问如下图

svn commit 错误:could not begin a transaction

发生错误could not begin a transaction,是因为 apache 没有svn仓库所在目录的权限。
修改 apache 帐号的权限:

shell> chown -R apache /home/svn/test

关于 Satisfy

如果不想让用户匿名访问svn仓库,就不要加这个选项了。
参考:

  • https://blog.csdn.net/weixin_34268169/article/details/92600408
  • https://cloud.tencent.com/developer/ask/sof/53801

参考

  • https://subversion.apache.org/packages.html
  • 《Subversion 与版本控制》 在线阅读:https://svnbook.red-bean.com/
  • Subversion 1.7 : https://svnbook.red-bean.com/en/1.7/index.html
  • Subversion 1.8 : https://svnbook.red-bean.com/nightly/zh/index.html

Linux 安装subversion+mod_dav_svn,搭建subversion(svn)服务器相关推荐

  1. Linux (CentOS 7 )下搭建局域网SVN服务器+SVN权限配置

    准备 公司内部需要配置局域网SVN,需要在在内部虚拟机服务器搭建,搭建过程做个记录,供参考. 注:如果条件允许,尽量在windows下搭建svn服务器,很省事,尤其是权限配置非常方便又易懂,效果相同 ...

  2. Mac搭建本地svn服务器,并用Cornerstone连接服务器

    Mac搭建本地svn服务器,并用Cornerstone连接服务器 Mac默认已经安装了svn,我们只需要进行配置并开启就可以了 首先我们可以验证一下是否安装了svn,打开终端,输入命令: svnser ...

  3. 怎样搭建本地svn服务器环境-轻松掌握版本管理

    版本管理一直是程序员使用频率比较高的一个工具软件.不管你是自己使用还是提供给别人使用,svn服务器的架设是一个入门功课.今天我们先来介绍一下怎么样在本地搭建svn服务器.这种应用一般是网络不是很好,提 ...

  4. 群晖 python_利用群晖Docker安装ubuntu16.04搭建python网站服务器(安装篇)

    折腾的原因:我目前有两个网站需要挂载,因为为了玩,并不是为了大流量,所以就挂在家里的群晖中.一个是小圈子(www.cirdown.com:81),因为用的是discuz论坛,php的,所以直接用我的黑 ...

  5. 群晖python套件包_利用群晖Docker安装ubuntu16.04搭建python网站服务器(部署篇)

    在帖子<利用群晖Docker安装ubuntu16.04搭建python网站服务器(安装篇)(地址:http://www.cirdown.com:81/thread-185-1-1.html)&g ...

  6. svn 使用TortoiseSVN server搭建本地SVN服务器

    使用TortoiseSVN server搭建本地SVN服务器 转载于:https://www.cnblogs.com/fireblackman/p/10799625.html

  7. Dnsmasq安装与配置-搭建本地DNS服务器 更干净更快无广告DNS解析

    Dnsmasq安装与配置-搭建本地DNS服务器 更干净更快无广告DNS解析 文章目录 Dnsmasq安装 Dnsmasq配置 Dnsmasq启动 Dnsmasq使用 Dnsmasq小结 默认的情况下, ...

  8. CentOS 搭建简单svn服务器【转】

    注:1.我这里不认subversion 只认svn.. 2.按照原文例子,配置文件的目录应该为:/opt/svndata/kuming/conf/ 原文:http://holy2010.blog.51 ...

  9. 安装nginx并搭建nginx图片服务器

    1.安装所需的包:yum install -y apr* autoconf automake bison bzip2 bzip2* cloog-ppl compat* cpp curl curl-de ...

  10. 数据库linux安装prm,在Ubuntu 18.04服务器上安装Monica PRM的步骤

    本文介绍在Ubuntu 18.04 LTS服务器上安装Monica PRM(Monica Personal Relationship Manager)的方法,要安装Monical需要的条件是:PHP ...

最新文章

  1. ORA-01113 file 1 needs media recovery
  2. 7 series FPGA DSP48E介绍
  3. mounted钩子函数_vue3.0项目开发(八)新特性之响应式系统watchEffect函数
  4. 【操作系统】考研の处理机调度算法(看不懂你来打我~!)
  5. 如何在bootstap中修改checkbox的样式
  6. 任务47:Identity MVC:ReturnUrl实现
  7. c语言字符串如何调换位置,c语言字符串从第m个位置开始复制
  8. 算法研究NO8.用数理统计法消除粗大误差
  9. java代码防查重工具_代码查重工具sim
  10. 斯坦福 机器学习-第一章监督学习
  11. urdf 学习与制作
  12. 如何绘制好看的大脑皮层图?wb_view +fun.gii格式操作
  13. NaN是什么?NaN == NaN 的结果是什么?为什么?
  14. AU插件安装 - FabFilter、RX
  15. 面试题目总结(CNN)
  16. 训练深度网络模型,刚开始约10epoch的loss下降幅度很大,在大约10个epoch之后,变得非常缓慢。请问是什么问题呢?
  17. 无线射频模组生产测试的流程
  18. snort规则检测引擎初探
  19. 找不到认证服务器 是否网卡选择错误,锐捷上网认证常见问题及解决办法
  20. 「全志科技R329智能语音开发板」简介

热门文章

  1. mysql 如何自定义排序_在MySQL中实现自定义排序顺序
  2. 车载手机无线充电前装搭载同比增长超120%,两家中国供应商领跑
  3. 2016-05-09 随感,生活还是眼前的苟且
  4. 2021内蒙古师大附中高考成绩查询,内蒙古师大附中成绩公布,呼和浩特最好的4所高中,高考大比拼!...
  5. 91 Decode Ways
  6. channel 的基本使用
  7. 【微信小程序】的惊鸿一瞥
  8. onethink 搬家注意事项
  9. 在线屏幕测试检查工具
  10. MFC计算器 ---- 进阶版