1. 安装 Subversion

Subversion is built on a portability layer called APR—the Apache Portable Runtime library. The APR library provides all the interfaces that Subversion needs to function on different operating systems: disk access, network access, memory management, and so on. While Subversion is able to use Apache HTTP Server (or, httpd) as one of its network server programs, its dependence on APR does not mean that httpd is a required component. APR is a standalone library usable by any application. It does mean, however, that Subversion clients and servers run on any operating system that httpd runs on: Windows, Linux, all flavors of BSD, Mac OS X, NetWare, and others.

The easiest way to get Subversion is to download a binary package built for your operating system. Subversion's web site (http://subversion.apache.org) often has these packages available for download, posted by volunteers. The site usually contains graphical installer packages for users of Microsoft operating systems. If you run a Unix-like operating system, you can use your system's native package distribution system (RPMs, DEBs, the ports tree, etc.) to get Subversion.

此外,还可以通过编译源代码包直接生成 Subversion 程序,尽管这不是一件简单的任务(如果你没有构建过开源软件包,你最好下载二进制发布版本!)。首先,从 Subversion 网站下载最新的源代码包,然后解压缩。然后,根据 INSTALL 文件的指示进行编译。需要注意的是,正式发布的源代码包中可能没有包含构建命令行客户端工具所需的全部内容,从 Subversion 1.4 开始,所有依赖的库(如 apr,apr-util 和 neon 库)以 -deps 为名称单独发布,这些库应该可以满足你在你的系统上的安装,你需要将依赖库解压缩到 Subversion 源程序相同的目录。但是一些可选的组件则依赖于其它一些程序库,如 Berkeley DB 和 Apache httpd。因此,如果想要进行完整的编译,请根据 INSTALL 文件中的内容确认这些程序库是否可用。

If you're one of those folks that likes to use bleeding-edge software, you can also get the Subversion source code from the Subversion repository in which it lives. Obviously, you'll need to already have a Subversion client on hand to do this. But once you do, you can check out a working copy from http://svn.apache.org/repos/asf/subversion[64]:

$ svn checkout http://svn.apache.org/repos/asf/subversion/trunk subversion
A    subversion/HACKING
A    subversion/INSTALL
A    subversion/README
A    subversion/autogen.sh
A    subversion/build.conf
…

上面的命令会检出最新(尚未发布)的 Subversion 源代码版本到你的当前工作目录的名为 subversion 的子目录中。很明显,你可以调整最后的参数改为你需要的。不管你怎么称呼它,在操作完成后,你已经有了 Subversion 的源代码。当然,你还是需要得到一些支持库(apr,apr-util 等等)—参见工作副本根目录的 INSTALL 以了解详情。



[64] Note that the URL checked out in the example ends not with subversion, but with a subdirectory thereof called trunk. See our discussion of Subversion's branching and tagging model for the reasoning behind this.