Apache Subversion 安装指南

在 Ubuntu 22.04 上从零安装 Apache Subversion 1.14 集中式版本控制系统,覆盖 apt 在线安装与官方源码编译两种方案、svnserve 与 Apache WebDAV 双服务模式、systemd 托管、认证授权、升级锁版与卸载清理,全部命令与回显逐步实测。

Apache SubversionApache Subversion2026/10/12

Apache Subversion 安装指南

目标:在真实 Ubuntu 22.04 服务器上从零安装 Apache Subversion(集中式版本控制系统),覆盖 apt 在线安装与官方源码编译两种方案、svnserve 独立服务与 Apache WebDAV 两种访问模式、systemd 托管、认证授权与验证回显。以下命令与回显均在 Ubuntu 22.04.5 LTS 环境逐步实测。

一、环境信息

  • 操作系统:Ubuntu 22.04.5 LTS(x86_64)
  • Apache Subversion:1.14.1-3ubuntu0.22.04.1(apt 方案,universe 仓库)
  • Apache HTTP Server:2.4.52-1ubuntu4.24(WebDAV 访问模式使用)
  • libapache2-mod-svn:1.14.1-3ubuntu0.22.04.1
  • 源码编译版:Apache Subversion 1.14.5(r1922182),安装目录 /usr/local/subversion
  • 版本库目录:/srv/svn/repo1
  • 端口:svnserve 模式 3690;Apache WebDAV 模式 80
  • 运行用户:安装与验证以 root 执行;svnserve 服务以系统用户 svn 运行;Apache 以 www-data 运行

💡 说明:Apache Subversion 于 2010 年成为 Apache 顶级项目,1.14.x 是当前官方长期维护的版本线,apt 安装与源码编译得到的都是 1.14 系列,配置与版本库格式完全互通。

二、前置条件

  • 一台 Ubuntu 22.04 服务器,具备 root 权限。
  • 网络可达 archive.ubuntu.com(apt 源)与 dlcdn.apache.org 或 archive.apache.org(Apache 官方源码包)。
  • 建议提前安装 net-tools(提供 netstat)、curl 两个验证工具。
  • 方案 B(源码编译)需要额外安装编译工具链与 APR/APR-util/serf 开发库(见 5.1)。

三、版本选型说明

组件推荐版本说明
Apache Subversion1.14.1(apt)/ 1.14.5(源码)1.14 为官方维护线;Ubuntu 22.04 仓库随安全更新滚动
Apache HTTP Server2.4.52搭配 libapache2-mod-svn 提供 WebDAV 访问
subversion-tools与 subversion 同版本提供 svnadmin 配套管理工具与备份脚本

获取上游最新版本的命令(实测回显):

# curl -s https://downloads.apache.org/subversion/ | grep -oE "subversion-1\.14\.[0-9]+" | sort -u
subversion-1.14.5

四、apt 在线安装方案(A)

4.1 安装软件包

apt-get update -qq
DEBIAN_FRONTEND=noninteractive apt-get install -y \
    subversion subversion-tools apache2 libapache2-mod-svn net-tools curl

安装末尾真实回显(节选):

Setting up subversion (1.14.1-3ubuntu0.22.04.1) ...
Setting up subversion-tools (1.14.1-3ubuntu0.22.04.1) ...
Setting up apache2 (2.4.52-1ubuntu4.24) ...
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.service.
Setting up libapache2-mod-svn (1.14.1-3ubuntu0.22.04.1) ...
apache2_invoke: Enable module dav_svn
apache2_invoke: Enable module authz_svn

💡 安装 libapache2-mod-svn 时会自动执行 a2enmod dav_svn、a2enmod authz_svn,即 dav、dav_svn、authz_svn 模块在安装后已处于启用状态,WebDAV 模式只需补充配置(见 7.4)。

4.2 版本验证

# svn --version
svn, version 1.14.1 (r1886195)
   compiled May 21 2022, 10:52:35 on x86_64-pc-linux-gnu

Copyright (C) 2021 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/

# svnserve --version
svnserve, version 1.14.1 (r1886195)
   compiled May 21 2022, 10:52:35 on x86_64-pc-linux-gnu

Copyright (C) 2021 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.

# svnadmin --version
svnadmin, version 1.14.1 (r1886195)
   compiled May 21 2022, 10:52:35 on x86_64-pc-linux-gnu

Copyright (C) 2021 The Apache Software Foundation.

# apachectl -v
Server version: Apache/2.4.52 (Ubuntu)
Server built:   2026-10-05T17:25:19

# dpkg -l subversion subversion-tools apache2 libapache2-mod-svn
ii  apache2            2.4.52-1ubuntu4.24      amd64        Apache HTTP Server
ii  libapache2-mod-svn 1.14.1-3ubuntu0.22.04.1 amd64        Apache Subversion server modules for Apache httpd
ii  subversion         1.14.1-3ubuntu0.22.04.1 amd64        Advanced version control system
ii  subversion-tools   1.14.1-3ubuntu0.22.04.1 amd64        Assorted tools related to Apache Subversion

4.3 安装内容速览

# dpkg -L subversion subversion-tools 2>/dev/null | grep /usr/bin/ | sort
/usr/bin/fsfs-access-map
/usr/bin/fsfs-stats
/usr/bin/svn
/usr/bin/svn-backup-dumps
/usr/bin/svn-bisect
/usr/bin/svn-clean
/usr/bin/svn-hot-backup
/usr/bin/svn-mergeinfo-normalizer
/usr/bin/svn-populate-node-origins-index
/usr/bin/svn-vendor
/usr/bin/svn_apply_autoprops
/usr/bin/svn_load_dirs
/usr/bin/svnadmin
/usr/bin/svnauthz
/usr/bin/svnauthz-validate
/usr/bin/svnbench
/usr/bin/svndumpfilter
/usr/bin/svnfsfs
/usr/bin/svnlook
/usr/bin/svnmucc
/usr/bin/svnraisetreeconflict
/usr/bin/svnrdump
/usr/bin/svnserve
/usr/bin/svnsync
/usr/bin/svnversion
/usr/bin/svnwrap

⚠️ Ubuntu 22.04 的 subversion 包不附带 svnserve 的 systemd 服务单元(dpkg -L subversion | grep systemd 无结果),使用 svnserve 模式需按 7.2 手工创建服务单元。

五、源码编译安装方案(B)

5.1 安装编译依赖

DEBIAN_FRONTEND=noninteractive apt-get install -y \
    build-essential libapr1-dev libaprutil1-dev libserf-dev \
    zlib1g-dev libsqlite3-dev libexpat1-dev libssl-dev gettext pkg-config

5.2 下载官方源码包

cd /root
curl -sLO https://dlcdn.apache.org/subversion/subversion-1.14.5.tar.gz

真实回显与校验值:

# ls -lh subversion-1.14.5.tar.gz
-rw-r--r-- 1 root root 12M Oct 12 00:53 subversion-1.14.5.tar.gz

# sha256sum subversion-1.14.5.tar.gz
cd143fe8fdb1cd506c438eef1c772a2e87e1519e6b0be3fcd54a8c59e9022390  subversion-1.14.5.tar.gz

💡 dlcdn.apache.org 只保留最新版本,历史版本从 archive.apache.org/dist/subversion/ 下载(实测两个站点对该包均返回 200)。

5.3 解压与 configure

tar -xzf subversion-1.14.5.tar.gz
cd subversion-1.14.5
./configure --prefix=/usr/local/subversion --with-serf \
    --with-lz4=internal --with-utf8proc=internal

configure 成功时末尾回显:

config.status: creating subversion/bindings/swig/perl/native/Makefile.PL
config.status: creating subversion/svn_private_config.h.tmp
config.status: executing libtool commands
config.status: executing svn_private_config.h.tmp commands

⚠️ 踩坑记录一:未安装 pkg-config 时,--with-serf 检测失败报错 configure: error: Serf was explicitly enabled but an appropriate version was not found. 定位:configure 通过 pkg-config 读取 serf-1.pc,Ubuntu 22.04 的 libserf-dev(1.3.9-10ubuntu2)自带 serf-1.pc,缺 pkg-config 命令即可导致检测失败。解决:apt-get install -y pkg-config 后重新 configure。

⚠️ 踩坑记录二:系统缺 liblz4-dev(或版本低于 r129)时报错 configure: error: Subversion requires LZ4 >= r129, or use --with-lz4=internal 解决:加 --with-lz4=internal(utf8proc 同理加 --with-utf8proc=internal),使用源码内 bundled 库编译。

5.4 编译与安装

make -j$(nproc)
make install

编译耗时数分钟(取决于 CPU),完成后验证安装内容:

# ls /usr/local/subversion/bin
svn
svnadmin
svnbench
svndumpfilter
svnfsfs
svnlook
svnmucc
svnrdump
svnserve
svnsync
svnversion

5.5 验证源码版本

# /usr/local/subversion/bin/svn --version
svn, version 1.14.5 (r1922182)
   compiled Oct 12 2026, 00:54:28 on x86_64-unknown-linux-gnu

Copyright (C) 2024 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.
  - 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' scheme

The following authentication credential caches are available:

* GPG-Agent

六、多方案对比与选择建议

维度方案 A:apt 在线安装方案 B:源码编译安装
版本1.14.1(随仓库安全更新)1.14.5(上游最新)
是否需联网需访问 Ubuntu 仓库需访问 dlcdn.apache.org 下载包
安装方式apt 包管理器configure + make install
安装路径/usr/bin、/usr/lib/usr/local/subversion
systemd 服务Apache 自带;svnserve 需自建(两方案相同)同左,二进制路径改为 /usr/local/subversion/bin
升级方式apt-get upgrade / unhold重新编译新版本
优点快、依赖自动处理、便于回滚版本最新、可定制编译特性
缺点版本略滞后于上游耗时长、需手工管理升级

选择建议:可联网的生产服务器优先方案 A,配合 apt-mark hold 控制升级节奏;需要上游最新特性或加固参数时选方案 B。两方案的版本库格式同为 FSFS,可互相访问,无需迁移。

七、基础配置与验证

7.1 创建第一个版本库

mkdir -p /srv/svn
svnadmin create /srv/svn/repo1

目录结构与完整性验证:

# ls -la /srv/svn/repo1
total 32
drwxr-xr-x 6 root root 4096 Oct 12 00:45 .
drwxr-xr-x 3 root root 4096 Oct 12 00:45 ..
-rw-r--r-- 1 root root  246 Oct 12 00:45 README.txt
drwxr-xr-x 2 root root 4096 Oct 12 00:45 conf
drwxr-sr-x 6 root root 4096 Oct 12 00:45 db
-r--r--r-- 1 root root    2 Oct 12 00:45 format
drwxr-xr-x 2 root root 4096 Oct 12 00:45 hooks
drwxr-xr-x 2 root root 4096 Oct 12 00:45 locks

# svnadmin verify /srv/svn/repo1
* Verifying metadata at revision 0 ...
* Verified revision 0.

7.2 svnserve 独立服务模式(svn://)

写入三个配置文件(均为覆盖式最小生效内容):

cat > /srv/svn/repo1/conf/svnserve.conf <<'EOF'
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
realm = repo1
EOF

cat > /srv/svn/repo1/conf/passwd <<'EOF'
[users]
admin = q1w2e3r4
EOF

cat > /srv/svn/repo1/conf/authz <<'EOF'
[groups]
dev = admin

[/]
@dev = rw
* =
EOF

创建系统用户并编写 systemd 服务单元:

useradd --system --home /srv/svn --shell /usr/sbin/nologin svn
chown -R svn:svn /srv/svn/repo1

cat > /etc/systemd/system/svnserve.service <<'EOF'
[Unit]
Description=Subversion protocol daemon (svnserve)
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/svnserve --daemon --foreground --root /srv/svn
Restart=on-failure
User=svn
Group=svn

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable svnserve
systemctl start svnserve

真实回显:

# systemctl enable svnserve
Created symlink /etc/systemd/system/multi-user.target.wants/svnserve.service → /etc/systemd/system/svnserve.service.

# systemctl status svnserve --no-pager -l
● svnserve.service - Subversion protocol daemon (svnserve)
     Loaded: loaded (/etc/systemd/system/svnserve.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2026-10-12 00:47:42 UTC; 1s ago
   Main PID: 4026 (svnserve)
      Tasks: 1 (limit: 5753)
     Memory: 1.0M
        CPU: 6ms
     CGroup: /system.slice/svnserve.service
             └─4026 /usr/bin/svnserve --daemon --foreground --root /srv/svn

Oct 12 00:47:42 svn-server systemd[1]: Started Subversion protocol daemon (svnserve).

# systemctl is-enabled svnserve
enabled

# netstat -tlnp | grep 3690
tcp        0      0 0.0.0.0:3690            0.0.0.0:*               LISTEN      4026/svnserve

7.3 svn:// 模式访问验证

匿名访问被拒绝(anon-access = none 生效):

# svn checkout svn://127.0.0.1/repo1/project-trunk/trunk wc-svn
svn: E170013: Unable to connect to a repository at URL 'svn://127.0.0.1/repo1/project-trunk/trunk'
svn: E170001: Can't get username or password

密码错误时的回显:

# svn co svn://127.0.0.1/repo1/project-trunk/trunk wc-bad --username admin --password wrongpass --non-interactive
svn: E170013: Unable to connect to a repository at URL 'svn://127.0.0.1/repo1/project-trunk/trunk'
svn: E170001: Authentication error from server: Password incorrect

带认证完成导入、检出、提交、日志的完整链路:

# mkdir -p project-trunk/{trunk,branches,tags}
# echo "hello subversion" > project-trunk/trunk/README.md
# echo "# -*- config demo -*-" > project-trunk/trunk/app.conf
# svn import -m "initial import" project-trunk svn://127.0.0.1/repo1/project-trunk --username admin --password q1w2e3r4 --non-interactive
Adding         project-trunk/branches
Adding         project-trunk/tags
Adding         project-trunk/trunk
Adding         project-trunk/trunk/README.md
Adding         project-trunk/trunk/app.conf
Committing transaction...
Committed revision 1.

# svn checkout svn://127.0.0.1/repo1/project-trunk/trunk wc-svn --username admin --password q1w2e3r4 --non-interactive
A    wc-svn/README.md
A    wc-svn/app.conf
Checked out revision 1.

# cd wc-svn
# echo "line2 added via svnserve" >> README.md
# svn commit -m "modify README via svn protocol" --username admin --password q1w2e3r4 --non-interactive
Sending        README.md
Transmitting file data .done
Committing transaction...
Committed revision 2.

# svn update --username admin --password q1w2e3r4 --non-interactive
Updating '.':
At revision 2.

# svn log --username admin --password q1w2e3r4 --non-interactive
------------------------------------------------------------------------
r2 | admin | 2026-10-12 00:48:02 +0000 (Mon, 12 Oct 2026) | 1 line

modify README via svn protocol
------------------------------------------------------------------------
r1 | admin | 2026-10-12 00:47:57 +0000 (Mon, 12 Oct 2026) | 1 line

initial import
------------------------------------------------------------------------

# svn info --username admin --password q1w2e3r4 --non-interactive
Path: .
Working Copy Root Path: /root/work/wc-svn
URL: svn://127.0.0.1/repo1/project-trunk/trunk
Relative URL: ^/project-trunk/trunk
Repository Root: svn://127.0.0.1/repo1
Repository UUID: 733533be-a0e7-445c-904e-d11967ae5c52
Revision: 1
Node Kind: directory
Schedule: normal
Last Changed Author: admin
Last Changed Rev: 1
Last Changed Date: 2026-10-12 00:47:57 +0000 (Mon, 12 Oct 2026)

7.4 Apache WebDAV 模式(http://)

确认模块启用状态并创建认证文件:

a2enmod dav_svn authz_svn
mkdir -p /etc/svn
htpasswd -cb /etc/svn/svn.htpasswd admin q1w2e3r4
htpasswd -b /etc/svn/svn.htpasswd root q1w2e3r4
# a2enmod dav_svn authz_svn
Considering dependency dav for dav_svn:
Module dav already enabled
Module dav_svn already enabled
Considering dependency dav_svn for authz_svn:
Considering dependency dav for authz_svn:
Module dav already enabled
Module dav_svn already enabled
Module authz_svn already enabled

# htpasswd -cb /etc/svn/svn.htpasswd admin q1w2e3r4
Adding password for user admin
# htpasswd -b /etc/svn/svn.htpasswd root q1w2e3r4
Adding password for user root
# cat /etc/svn/svn.htpasswd
admin:$apr1$gyKFMzH0$LA/ny1eCGM.H1dYee1roj0
root:$apr1$2mUtcCXz$MzZOjVtGKuNAhJZK9etGh0

编辑 /etc/apache2/mods-enabled/dav_svn.conf(安装后默认全注释,写入生效内容):

<Location /svn>
    DAV svn
    SVNParentPath /srv/svn
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /etc/svn/svn.htpasswd
    AuthzSVNAccessFile /etc/svn/authz
    Require valid-user
</Location>

写入路径级授权文件 /etc/svn/authz:

[groups]
dev = admin, root

[/]
@dev = rw

[repo1:/]
@dev = rw

解决双服务写权限冲突:Apache 以 www-data 运行、svnserve 以 svn 运行,把 www-data 加入 svn 组并对版本库目录开组写权限。

usermod -aG svn www-data
chown -R svn:svn /srv/svn/repo1
chmod -R g+rwX /srv/svn/repo1

配置检查、消除主机名告警并启动服务:

echo "ServerName svn-server" > /etc/apache2/conf-available/servername.conf
a2enconf servername
systemctl enable apache2
systemctl restart apache2
# apachectl configtest
Syntax OK

# a2enconf servername
Enabling conf servername.

# systemctl status apache2 --no-pager
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2026-10-12 00:49:14 UTC; 2s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 4212 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 4216 (apache2)
      Tasks: 55 (limit: 5753)
     Memory: 8.5M
        CPU: 51ms
     CGroup: /system.slice/apache2.service
             ├─4216 /usr/sbin/apache2 -k start
             ├─4217 /usr/sbin/apache2 -k start
             └─4218 /usr/sbin/apache2 -k start

# netstat -tlnp | grep -E ":80 |:3690"
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      4216/apache2
tcp        0      0 0.0.0.0:3690            0.0.0.0:*               LISTEN      4026/svnserve

7.5 http:// 模式访问验证

未认证请求返回 401 并携带 Basic 质询:

# curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1/svn/repo1/
401

# curl -s -i http://127.0.0.1/svn/repo1/ | head -5
HTTP/1.1 401 Unauthorized
Date: Mon, 12 Oct 2026 00:49:31 GMT
Server: Apache/2.4.52 (Ubuntu)
WWW-Authenticate: Basic realm="Subversion Repository"
Content-Length: 456

认证后浏览得到版本库 HTML 索引(由 mod_dav_svn 自动生成):

# curl -s http://127.0.0.1/svn/repo1/ -u admin:q1w2e3r4
<html><head><title>repo1 - Revision 2: /</title></head>
<body>
 <h2>repo1 - Revision 2: /</h2>
 <ul>
  <li><a href="project-trunk/">project-trunk/</a></li>
 </ul>
 <hr noshade><em>Powered by <a href="http://subversion.apache.org/">Apache Subversion</a> version 1.14.1 (r1886195).</em>
</body></html>

svn 客户端走 http:// 完成检出与提交:

# svn checkout http://127.0.0.1/svn/repo1/project-trunk/trunk wc-http --username admin --password q1w2e3r4 --non-interactive
A    wc-http/README.md
A    wc-http/app.conf
Checked out revision 2.

# cd wc-http
# echo "line3 added via http webdav" >> README.md
# svn commit -m "modify README via http protocol" --username admin --password q1w2e3r4 --non-interactive
Sending        README.md
Transmitting file data .done
Committing transaction...
Committed revision 3.

# svn info http://127.0.0.1/svn/repo1 --username admin --password q1w2e3r4 --non-interactive
Path: repo1
URL: http://127.0.0.1/svn/repo1
Relative URL: ^/
Repository Root: http://127.0.0.1/svn/repo1
Repository UUID: 733533be-a0e7-445c-904e-d11967ae5c52
Revision: 3
Node Kind: directory
Last Changed Author: admin
Last Changed Rev: 3

八、升级、降级与多版本管理

  • 升级(apt 方案):apt-get update && apt-get install --only-upgrade subversion subversion-tools libapache2-mod-svn。
  • 锁定版本防误升级(实测回显):
# apt-mark hold subversion
subversion set on hold.
# apt-mark showhold
subversion
# apt-mark unhold subversion
Canceled hold on subversion.
  • 修复式重装(等同回到当前候选版本):apt-get install --reinstall subversion。
  • 查询可安装版本与来源:apt-cache policy subversion(实测当前候选 1.14.1-3ubuntu0.22.04.1,来源 jammy-updates/universe)。
  • 源码版与 apt 版共存:源码版装在 /usr/local/subversion,把 /usr/local/subversion/bin 置于 PATH 前面即可优先生效;用 which svn 与 svn --version 核对实际调用路径。两套安装互不干扰,apt 版位于 /usr/bin/svn。
  • 卸载源码版:Subversion 的 Makefile 不提供 uninstall 目标(实测 make uninstall 报 No rule to make target 'uninstall'),直接 rm -rf /usr/local/subversion 即可,apt 版不受影响。

九、常见问题(FAQ)

Q1:Apache 启动时报 Could not reliably determine the server's fully qualified domain name,如何消除?

实测回显(apachectl configtest 时出现):AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.7. Set the 'ServerName' directive globally to suppress this message。定位:未设置全局 ServerName,Apache 反解主机名失败。解决:echo "ServerName svn-server" > /etc/apache2/conf-available/servername.conf && a2enconf servername && systemctl reload apache2(回显 Enabling conf servername.),再次 configtest 只余 Syntax OK。

Q2:源码 configure 报 Serf was explicitly enabled but an appropriate version was not found

定位:configure 经 pkg-config 检测 serf-1.pc;未安装 pkg-config 或 libserf-dev 都会触发。解决:apt-get install -y pkg-config libserf-dev 后重新 configure(本环境 libserf-dev 1.3.9-10ubuntu2 检测通过)。

Q3:源码 configure 报 Subversion requires LZ4 >= r129, or use --with-lz4=internal

定位:系统 liblz4 版本不足或缺失。解决:按提示加 --with-lz4=internal;utf8proc 报同类错误时加 --with-utf8proc=internal,使用源码自带 bundled 库。

Q4:svn:// 访问报 E170001: Can't get username or password

定位:svnserve.conf 设了 anon-access = none,未带凭据的请求直接被拒(属预期行为,实测回显见 7.3)。解决:客户端加 --username admin --password q1w2e3r4;若确需匿名只读,把 anon-access 改为 read。

Q5:访问报 E215004: No more credentials or we tried too many times. Authentication failed

定位:用户名或密码错误,客户端尝试次数耗尽(http:// 与 svn:// 两种模式下实测回显一致)。解决:核对 passwd 文件(svnserve 模式)或 htpasswd 文件(WebDAV 模式)中的账号,必要时用 htpasswd -b /etc/svn/svn.htpasswd 用户名 新密码 重置。

Q6:提交报 E165001: Commit blocked by pre-commit hook (exit code 1) with output: Commit blocked: log message must not be empty

定位:pre-commit 钩子检测到提交说明为空,主动拦截。实测回显:

# svn commit -m "" --username admin --password q1w2e3r4 --non-interactive
Sending        README.md
Transmitting file data .done
Committing transaction...
svn: E165001: Commit failed (details follow):
svn: E165001: Commit blocked by pre-commit hook (exit code 1) with output:
Commit blocked: log message must not be empty

解决:提交必须带有效说明 svn commit -m "说明文字"(补充说明后实测正常入库 Committed revision 5.)。

Q7:svnsync 初始化报 E165006: Repository has not been enabled to accept revision propchanges

定位:svnsync 需要在目标库写 svn:log 等修订版属性,而目标库默认没有 pre-revprop-change 钩子。解决:在目标版本库 hooks 目录创建可执行的 pre-revprop-change 脚本(内容放行对应属性修改,实测放行后 svnsync init 回显 Copied properties for revision 0.)。

十、卸载与清理

apt 方案完整卸载:

systemctl disable --now svnserve
rm -f /etc/systemd/system/svnserve.service
systemctl daemon-reload
DEBIAN_FRONTEND=noninteractive apt-get purge -y subversion subversion-tools libapache2-mod-svn
rm -rf /srv/svn /etc/svn
userdel svn

💡 apache2 可按需保留:若该服务器仅为 Subversion 服务,再执行 apt-get purge -y apache2 apache2-* && apt-get autoremove -y 一并清理。

源码方案卸载:

rm -rf /usr/local/subversion
rm -rf /root/subversion-1.14.5 /root/subversion-1.14.5.tar.gz

十一、参考链接