从源码编译安装Subversion 1.8.9的完整指南
2014年5月25日 12:26:14
所需依赖包:Subversion 1.8.9、APR、APR-Util、SQLite3、Serf。
- Subversion:http://subversion.apache.org/download/
- APR/APR-Util:http://apr.apache.org/download.cgi
- Serf:https://code.google.com/p/serf/
安装步骤
1. 编译安装 APR
./configure make make install
2. 编译安装 APR-Util
./configure --with-apr=/usr/local/apr/bin/apr-1-config make make install
3. 准备 SQLite3
下载并解压 SQLite 合并文件,将其重命名为 sqlite-amalgamation 并放置到 Subversion 源码目录下。
wget http://www.sqlite.org/sqlite-amalgamation-3071501.zip unzip sqlite-amalgamation-3071501.zip mv sqlite-amalgamation-3071501 sqlite-amalgamation # 将整个 sqlite-amalgamation 目录复制到 svn 源码目录内
4. 编译安装 Serf(依赖 HTTP/HTTPS 协议支持)
Subversion 1.8 及更高版本使用 Serf 替换了 Neon。Serf 使用 SCons 构建,而 SCons 依赖 Python。请确保已安装 Python 2.x 或 3.x。
# 安装 SCons(如果未安装) pip install scons # 或使用系统包管理器 # 编译 Serf scons PREFIX=/usr/local/serf scons install
5. 编译安装 Subversion
./configure \ --with-apr=/usr/local/apr/bin/apr-1-config \ --with-apr-util=/usr/local/apr/bin/apu-1-config \ --with-serf=/usr/local/serf make make install
常见问题与解决
问题1:系统原有的 RPM 版 APR/APR-Util 冲突
如果执行 svn up 时出现类似以下错误:
svn: symbol lookup error: /usr/local/lib/libsvn_subr-1.so.0: undefined symbol: apr_atomic_xchgptr
则需卸载系统中通过 RPM 安装的 APR 和 APR-Util。
rpm -e --allmatches apr-util --nodeps rpm -e --allmatches apr --nodeps
问题2:编译 Subversion 时提示 make: *** [subversion/libsvn_subr/libsvn_subr-1.la] Error 1
可尝试在 configure 时将 --with-apr 和 --with-apr-util 指向源码包内的路径,而非已安装的二进制路径。
问题3:配置时提示 Serf was explicitly enabled but an appropriate version was not found
原因通常是 configure 时指定的 APR/APR-Util 配置脚本路径不正确。请确保使用 apr-1-config 和 apu-1-config 的完整路径。
问题4:运行时提示 libserf-1.so.1: cannot open shared object file
Serf 1.2.1 版本未生成 libserf-1.so.1,但 1.3.5 版本包含。如果使用较新版本后仍出现此问题,可手动创建软链接:
ln -s /usr/local/serf/lib/libserf-1.so.1.3.0 /usr/lib64/libserf-1.so.1
额外说明
- SQLite3 不需要安装,只需解压并复制到 Subversion 源码目录中。
- Serf 默认安装前缀为
/usr/local/serf,可通过PREFIX参数调整。 - 不同 Linux 发行版、不同安装顺序可能导致错误信息不一致,建议严格按文档顺序操作。
初次使用 Subversion 的用户名密码配置可参考:http://www.cnblogs.com/iLoveMyD/p/4233914.html
参考链接:
