编译httpd2.4.65用来提供svn服务

2025-11-25 13:51

查看安装文档

https://httpd.apache.org/docs/2.4/install.html

下载apr和apr-util

解压到 /httpd_source_tree_root/srclib/apr and /httpd_source_tree_root/srclib/apr-util (be sure the directory names do not have version numbers; for example, the APR distribution must be under /httpd_source_tree_root/srclib/apr/) and use ./configure's --with-included-apr option. On some platforms, you may have to install the corresponding -dev packages to allow httpd to build against your installed copy of APR and APR-Util.

https://apr.apache.org/download.cgi


进入httpd目录,编译

./configure --prefix=/usr/local/apache2 \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr \
--enable-so \
--enable-rewrite \
--enable-mods-shared=all \
--enable-dav \
--enable-maintainer-mode

安装subversion开发库

dnf install subversion subversion-devel -y

编译svn

./configure --with-apxs=/usr/local/apache2/bin/apxs --with-apache-libexecdir=/usr/local/apache2/modules --with-lz4=internal --with-utf8proc=internal


要在 /var/svn/repositories 下添加一个新的 SVN 仓库,操作非常简单,只需几步:

1. 创建仓库 使用 svnadmin create 命令,仓库名建议使用英文或数字(例如 newproject):

bash

svnadmin create /var/svn/repositories/newproject

2. 调整权限 确保 Apache 用户(此处为 apache)对仓库目录拥有读写权限:

bash

chown -R apache:apache /var/svn/repositories/newproject

chmod -R 755 /var/svn/repositories/newproject

# 也可设置为 750 视安全需求

3. 配置访问权限

如果使用了 AuthzSVNAccessFile(路径为 /var/svn/config/accessfile),需要编辑该文件,为新仓库添加访问规则。

例如添加:

text

[newproject:/]

* = r

admin = rw

具体规则根据你的用户组设置。

4. 无需重启 Apache 因为配置中使用了 SVNParentPath,Apache 会自动识别父目录下的新增子仓库,所以不需要重启 httpd。但如果访问时报错,可以执行 systemctl reload httpd 刷新配置。

# 工具配置