在 Centos 7 上安装 SVN

在 Centos 7 上安装 SVN

我对此感到很苦恼,我正在将网站和 SVN 服务器迁移到新的 Centos 主机,过去几天我一直在尝试让 SVN 正常工作,但没有成功。

我已经能够对其进行身份验证但登录后它会返回 404 。

今天早上为了测试,我全新安装了 Centos 7,禁用了 selinux 和 IPV6

并执行以下命令

yum install httpd subversion mod_dav_svn

vi /etc/httpd/conf.modules.d/10-subversion.conf

Alias /svn /var/www/svn
<Location /svn>
DAV svn
SVNParentPath /var/www/svn/
AuthType Basic
AuthName "SVN Repository"
AuthUserFile /etc/svn-auth-accounts
Require valid-user
</Location>

htpasswd -cm /etc/svn-auth-accounts testuser
New password:
Re-type new password:
Adding password for user testuser

mkdir /var/www/svn
cd /var/www/svn/
svnadmin create repo
chown apache.apache repo/

systemctl restart httpd.service
systemctl enable httpd.service

现在应该在 ipaddress/svn/repo 设置一个基本的 repo,但我什么也没得到,只有一个 404 页面。

我尝试过按照 svn 手册http://svnbook.red-bean.com/en/1.7/svn.serverconfig.httpd.html我将服务器配置缩减到尽可能小的版本

<Location /repos>
  DAV svn
  SVNPath /var/www/svn/repo
</Location>

它仍然返回 404 错误。

我曾尝试将 svn 的配置放在 conf.d 中名为 svn.conf 的文件中,但也无济于事。

systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-06-28 14:08:46 AEST; 4s ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 6272 (httpd)
   Status: "Processing requests..."
   CGroup: /system.slice/httpd.service
           ├─6272 /usr/sbin/httpd -DFOREGROUND
           ├─6273 /usr/sbin/httpd -DFOREGROUND
           ├─6274 /usr/sbin/httpd -DFOREGROUND
           ├─6275 /usr/sbin/httpd -DFOREGROUND
           ├─6276 /usr/sbin/httpd -DFOREGROUND
           └─6277 /usr/sbin/httpd -DFOREGROUND

sestatus
SELinux status:                 disabled

我知道在 Ubuntu 中你需要启用 Apache 的 mods 才能使它们工作,但我找不到任何地方说 Centos 也需要这样做。

有人能解释一下这里发生了什么吗?我真的很困惑,httpd error.log 显示

[Fri Jun 28 14:21:49.153012 2019] [auth_digest:notice] [pid 6260] AH01757: generating secret for digest authentication ...
[Fri Jun 28 14:21:49.153800 2019] [lbmethod_heartbeat:notice] [pid 6260] AH02282: No slotmem from mod_heartmonitor
[Fri Jun 28 14:21:49.156392 2019] [mpm_prefork:notice] [pid 6260] AH00163: Apache/2.4.6 (CentOS) SVN/1.7.14 configured -- resuming normal operations
[Fri Jun 28 14:21:49.156430 2019] [core:notice] [pid 6260] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

据我所知,没有树懒是一个常见的被忽视的问题 https://stackoverflow.com/questions/10612242/lbmethod-heartbeatnotice-no-slotmem-from-mod-heartmonitor-error-after-insta#17451995 https://stackoverflow.com/questions/10612242/lbmethod-heartbeatnotice-no-slotmem-from-mod-heartmonitor-error-after-insta

Server version: Apache/2.4.6 (CentOS)
Server built:   Apr 24 2019 13:45:48

svn, version 1.7.14 (r1542130)
   compiled Apr 11 2018, 02:40:28

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 access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
  - handles 'http' scheme
  - handles 'https' scheme
* 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

mod_dav_svn-1.7.14-14.el7.x86_64 already installed and latest version

需要帮助请叫我

谢谢,头发少了一点

答案1

您快到了。设置SvnPath/var/www/svn浏览至http://localhost/repos/repo

进一步的步骤:

  • 重新启用 SELinux
  • semanage fcontext如果需要,调整标签。可能semanage fcontext -a '/var/www/svn(/.*)?' -t httpd_sys_rw_content_t -u system_u -r object_r适合您的用例。查看httpd_selinux(8),应该已经存在了。
  • 运行 restorecon 重新标记,例如restorecon -Rv /var/www
  • 启用 TLS(安装和设置mod_ssl,请参阅了解详情。有点主观,但完整)

相关内容